当前位置:网站首页>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 ).
边栏推荐
- Coordinatorlayout appbarrayout recyclerview item exposure buried point misalignment analysis
- Prepare for 2022 and welcome the "golden three silver four". The "summary of Android intermediate and advanced interview questions in 2022" is fresh, so that your big factory interview can go smoothly
- 第十九届浙江省 I. Barbecue
- Notes | numpy-09 Broadcast
- Thesis reading_ Chinese medical model_ eHealth
- MPM model and ab pressure test
- Review the old and know the new: Notes on Data Science
- 文献阅读_基于多模态数据语义融合的旅游在线评论有用性识别研究(中文文献)
- sql语句模糊查询遇到的问题
- [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)
猜你喜欢

The usage of micro service project swagger aggregation document shows all micro service addresses in the form of swagger grouping

cookie session jwt

Three representations of signed numbers: original code, inverse code and complement code
![[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

Shuttle + Alluxio 加速内存Shuffle起飞

Valentine's day limited withdrawal guide: for one in 200 million of you

论文阅读_中文NLP_ELECTRA

联发科技2023届提前批IC笔试(题目)
![[set theory] relation properties (transitivity | transitivity examples | transitivity related theorems)](/img/c2/87358af6b2b2892a6eceb751b3b60c.jpg)
[set theory] relation properties (transitivity | transitivity examples | transitivity related theorems)
![[set theory] relation properties (reflexivity | reflexivity theorem | reflexivity | reflexivity theorem | example)](/img/2a/362f3b0491f721d89336d4f468c9dd.jpg)
[set theory] relation properties (reflexivity | reflexivity theorem | reflexivity | reflexivity theorem | example)
随机推荐
document. The problem of missing parameters of referer is solved
联发科技2023届提前批IC笔试(题目)
Handling record of electric skateboard detained by traffic police
Keepalived热备与HAProxy
[XSS bypass - protection strategy] understand the protection strategy and better bypass
1118 birds in forest (25 points)
Uipath practice (08) - selector
[set theory] relationship properties (common relationship properties | relationship properties examples | relationship operation properties)
MediaTek 2023 IC written examination approved in advance (topic)
Flutter monitors volume to realize waveform visualization of audio
JDBC database operation
The programmer resigned and was sentenced to 10 months for deleting the code. JD came home and said that it took 30000 to restore the database. Netizen: This is really a revenge
1103 integer factorization (30 points)
Market status and development prospect forecast of global heat curing adhesive industry in 2022
1087 all roads lead to Rome (30 points)
Learning record of arouter principle
Coordinatorlayout appbarrayout recyclerview item exposure buried point misalignment analysis
[backtrader source code analysis 5] rewrite several time number conversion functions in utils with Python
1094 the largest generation (25 points)
Objects. Requirenonnull method description