当前位置:网站首页>Gbase8s composite index (I)
Gbase8s composite index (I)
2022-07-03 05:01:00 【The heart sea is ordinary】
A simple index is an index created based on a column or function , The corresponding is the composite index . Composite index is also called composite index , That is, the index contains two or more columns .GBase8s The composite index of supports at most 16 Index columns , The total size of columns should be less than 390 bytes.
Examples of composite indexes are as follows :
create index ix_items on items(stock_num,manu_code);An example of a composite index is shown below :

Using composite index can reduce the number of indexes , Enhance the uniqueness of the index , At the same time, it can improve the performance of join query based on multi column combination . for example , Indexes ix_items It can improve the performance of the following query statements :
select * from items where stock_num=2 and manu_code='HSK';meanwhile , You can also use this index for the following queries :
select * from items where stock_num=2;When creating a composite index , We need to consider the order of columns , It should be the order from the most commonly used column to the least commonly used column , The order of discrimination from high to low .
(1) It is necessary to consider the SQL Statement , Which predicates ( That is to say where Columns used by conditions ) Most of the times .
(2) You need to consider the differentiation of columns , The discrimination of a column is the number of all different values in the column . Generally, the columns with high discrimination are placed in front , Put the columns with low discrimination behind . Suppose there is A,B Two ,A The discrimination of is 100000, and B The discrimination of is 10000, Then don't consider other factors , It is recommended to use (A,B).
When the above two conditions conflict , You need to consider the query that is emphasized in the application SQL And the actual test performance results , To determine the order of index columns . The above case, ,A The discrimination of is 100000,B The discrimination of is 10000, Suppose there is 50% Of SQL The statement only uses B Column query ,40% Used A,B Column , Then it is suggested to create (B,A) The order . here , If the application only queries A The performance requirements of columns are high , Then it needs to be considered in A Create a single index on .
For cases with little difference in discrimination , You need to determine the order of the index columns according to the actual test results . See the following GBase8s Composite index ( Two ).
边栏推荐
- 2022-02-12 daily clock in: problem fine brush
- Career planning of counter attacking College Students
- 论文阅读_中文NLP_ELECTRA
- Current market situation and development prospect forecast of the global fire boots industry in 2022
- [backtrader source code analysis 4] use Python to rewrite the first function of backtrader: time2num, which improves the efficiency by 2.2 times
- [XSS bypass - protection strategy] understand the protection strategy and better bypass
- Without 50W bride price, my girlfriend was forcibly dragged away. What should I do
- 5-36v input automatic voltage rise and fall PD fast charging scheme drawing 30W low-cost chip
- Notes | numpy-07 Slice and index
- 1099 build a binary search tree (30 points)
猜你喜欢

Learn to use the idea breakpoint debugging tool

The usage of micro service project swagger aggregation document shows all micro service addresses in the form of swagger grouping
![[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa](/img/a9/92059db74ccde03b84c69dfce35b37.jpg)
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa

Apache MPM model and ab stress test

Network security textual research recommendation

2022-02-11 daily clock in: problem fine brush

I stepped on a foundation pit today

LVS load balancing cluster of efficient multi-purpose cluster (NAT mode)

Do you know UVs in modeling?

Mobile terminal - uniapp development record (public request encapsulation)
随机推荐
[backtrader source code analysis 4] use Python to rewrite the first function of backtrader: time2num, which improves the efficiency by 2.2 times
Hire cashier (differential constraint)
[set theory] relationship properties (symmetry | symmetry examples | symmetry related theorems | antisymmetry | antisymmetry examples | antisymmetry theorems)
Distinguish between releases and snapshots in nexus private library
I stepped on a foundation pit today
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
The consumption of Internet of things users is only 76 cents, and the price has become the biggest obstacle to the promotion of 5g industrial interconnection
[backtrader source code analysis 5] rewrite several time number conversion functions in utils with Python
Literature reading_ Research on the usefulness identification of tourism online comments based on semantic fusion of multimodal data (Chinese Literature)
leetcode406. Rebuild the queue based on height
Why does I start with =1? How does this code work?
Unity tool Luban learning notes 1
[research materials] 2021 annual report on mergers and acquisitions in the property management industry - Download attached
The principle is simple, but I don't know how to use it? Understand "contemporaneous group model" in one article
Huawei personally ended up developing 5g RF chips, breaking the monopoly of Japan and the United States
sql语句模糊查询遇到的问题
MediaTek 2023 IC written examination approved in advance (topic)
Promise
[set theory] binary relation (example of binary relation operation | example of inverse operation | example of composite operation | example of limiting operation | example of image operation)
Keepalived热备与HAProxy