IP Library Granted Patent US 11,003,649
Granted Patent B2
US 11,003,649 · App. 15/996,237 · Granted May 11, 2021

Index establishment method and device

Inventors: Bowen Zheng (Hangzhou, CN); Yue Pan (Hangzhou, CN); Chuangxian Wei (Hangzhou, CN)
Assignee: ALIBABA GROUP HOLDING LIMITED
G06F16/2272G06F16/00G06F16/221G06F16/2237G06F16/2246G06F16/2255G06F16/319
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,003,649
App. No.
15/996,237
Granted
May 11, 2021
Kind
B2
Abstract

Embodiments of the present invention provide an index establishment method and device. The method can include determining, according to index status information of a column in a database within a preset time threshold, whether an index is to be established for the column; determining an index type according to the data information of the column; and establishing the index for the column according to the index type based on the determination that the index is to be established for the column.

Claims (82)

1. An index establishment method, comprising:

determining, according to index status information of a column in a database within a time threshold, whether an index is to be established for the column, wherein determining whether the index is to be established for the column comprises:

acquiring the index status information of the column within the time threshold,

determining, according to the index status information, whether a current index is used for the column within the time threshold,

in response to the current index being used for the column within the time threshold, determining whether a number of times that the current index has been used within the time threshold is not less than a preset number-of-times threshold, and

determining that an index is to be established for the column, in response to the number of times the current index has been used being not less than the number-of-times threshold;

determining an index type of a plurality of index types according to the data information of the column, wherein the plurality of index types comprise a B-Tree index and a Hash index and the determined index type is:

the B-tree index when the column is a continuous value type, and

the Hash index when a Join occurs in the column; and

establishing an index for the column according to the index type based on a determination that an index is to be established for the column.

2. The method of claim 1 , further comprising:

in response to the determination that an index is not to be established for the column, determining, after the time threshold, whether an index is to be established for the column.

3. The method of claim 2 , wherein determining, according to the index status information of the column in the database within the preset time threshold, whether an index is to be established for the column further comprises:

determining that an index is not to be established for the column, in response to the current index not being used for the column within the time threshold or the number of times that the current index has been used being less than the number-of-times threshold.

4. The method of claim 1 , wherein the plurality of index types further comprise an inverted index and a Bitmap index, and the determined index type is:

the inverted index in response to the number of words in the column being greater than a preset number-of-words threshold; and

the bitmap index in response to the number of words in the column being not greater than a preset number-of-words threshold, a Join not occurring, and the column being a discontinuous value type.

5. The method of claim 1 , further comprising:

receiving a retrieval expression;

dividing the retrieval expression into a plurality of sub-expressions;

querying whether a retrieval result corresponding to a sub-expression of the plurality of sub-expressions exists in a cache; and

in response to the retrieval result existing, generating a retrieval response to be returned to the user according to the retrieval result corresponding to the sub-expression and retrieval results of other sub-expressions; or

in response to a retrieval result corresponding to the sub-expression not existing, performing retrieval on the sub-expression by using an index of the column, obtaining a retrieval result corresponding to the sub-expression, and storing the obtained retrieval result in the cache after a retrieval response is generated according to the obtained retrieval result and retrieval results of other sub-expressions.

6. The method of claim 1 , further comprising, before determining, according to the index status information of the column in the database within the preset time threshold, whether an index is to be established for the column:

initializing the database;

constructing a first set of indexes for each column in the database according to a default index type; and

reconstructing a second set of indexes for each column after a preset period of time.

7. An index establishment device, comprising:

a memory storing a set of instructions, and

one or more processors configured to execute the set of instructions to cause the device to perform:

determining, according to index status information of a column in a database within a preset time threshold, whether an index is to be established for the column, wherein determining whether the index is to be established for the column comprises:

acquiring the index status information of the column within the time threshold,

determining, according to the index status information, whether a current index is used for the column within the time threshold,

in response to the current index being used for the column within the time threshold, determining whether a number of times that the current index has been used within the time threshold is not less than a preset number-of-times threshold, and

determining that an index is to be established for the column, in response to the number of times that the current index has been used being not less than the number-of-times threshold; and

determining an index type of a plurality of index types according to the data information of the column, wherein the plurality of index types comprise a B-Tree index and a Hash index and the determined index type is:

the B-tree index when the column is a continuous value type, and

the Hash index when a Join occurs in the column; and

establishing an index for the column according to the index type based on a determination that an index is to be established for the column.

8. The device of claim 7 , wherein the one or more processors are further configured to execute the set of instructions to cause the device to perform:

in response to the determination that an index is not to be established for the column, determining, after the time threshold, whether an index is to be established for the column.

9. The device of claim 8 , wherein the one or more processors are further configured to execute the set of instructions to cause the device to perform:

determining that an index is not to be established for the column in response to the current index not being used for the column within the time threshold or the number of times the current index has been used being less than the number-of-times threshold.

10. The device of claim 8 , wherein the plurality of index types further comprise an inverted index and a Bitmap index, and the determined index type is:

the inverted index in response to the number of words in the column being greater than a preset number-of-words threshold; or

the bitmap index in response to the number of words in the column being not greater than a preset number-of-words threshold, a Join not occurring, and the column being a discontinuous value type.

11. The device of claim 8 , wherein the one or more processors are further configured to execute the set of instructions to cause the device to perform:

receiving a retrieval expression and divide the retrieval expression into a plurality of sub-expressions;

querying whether a retrieval result corresponding to a sub-expression of the plurality of sub-expressions exists in a cache;

generating, according to the retrieval results of the sub-expressions, a retrieval response to be returned to the user in response to the retrieval result existing, or

performing retrieval on the sub-expression by using an index of the column, obtaining a retrieval result corresponding to the sub-expression, and storing the obtained retrieval result in the cache after a retrieval response is generated according to the obtained retrieval result and retrieval results of other sub-expressions, in response to a retrieval result corresponding to the sub-expression not existing.

12. The device of claim 8 , wherein the one or more processors are further configured to execute the set of instructions to cause the device to perform:

initializing the database;

constructing a first set of indexes for each column in the database according to a default index type; and

reconstructing a second set of indexes for each column after a preset period of time.

13. A non-transitory computer readable medium that stores a set of instructions that is executable by at least one processor of a computing system to cause the computing system to perform an index establishment method, the method comprising:

determining, according to index status information of a column in a database within a preset time threshold, whether an index is to be established for the column wherein determining whether the index is to be established for the column comprises:

acquiring the index status information of the column within the time threshold,

determining, according to the index status information, whether a current index is used for the column within the time threshold,

in response to the current index being used for the column within the time threshold, determining whether a number of times that the current index has been used within the time threshold is not less than a preset number-of-times threshold, and

determining that an index is to be established for the column, in response to the number of times the current index has been used being not less than the number-of-times threshold;

determining an index type of a plurality of index types according to the data information of the column, wherein the plurality of index types comprise a B-Tree index and a Hash index and the determined index type is:

the B-tree index when the column is a continuous value type, and

the Hash index in response when a Join occurs in the column; and

establishing an index for the column according to the index type based on a determination that an index is to be established for the column.

14. The non-transitory computer readable medium of claim 13 , wherein the method further comprises:

in response to the determination that an index is not to be established for the column, determining, after the time threshold, whether an index is to be established for the column.

15. The non-transitory computer readable medium of claim 14 , wherein determining, according to the index status information of the column in the database within the preset time threshold, whether an index is to be established for the column further comprises:

determining that an index is not to be established for the column, in response to the current index not being used for the column within the time threshold or the number of times the current index has been used being less than the number-of-times threshold.

16. The non-transitory computer readable medium of claim 13 , wherein the plurality of index types further comprise an inverted index and a Bitmap index, and the determined index type is:

the inverted index in response to the number of words in the column being greater than a preset number-of-words threshold; and

the bitmap index in response to the number of words in the column being not greater than a preset number-of-words threshold, a Join not occurring, and the column being a discontinuous value type.

17. The non-transitory computer readable medium of claim 13 , further comprising:

receiving a retrieval expression;

dividing the retrieval expression into a plurality of sub-expressions;

querying whether a retrieval result corresponding to a sub-expression of the plurality of sub-expressions exists in a cache; and

in response to the retrieval result existing, generating, according to the retrieval results of the sub-expressions, a retrieval response to be returned to the user, or

in response to a retrieval result corresponding to the sub-expression not existing, performing retrieval on the sub-expression by using an index of the column, obtaining a retrieval result corresponding to the sub-expression, and storing the obtained retrieval results in the cache after a retrieval response is generated according to the obtained retrieval results of the sub-expressions.

18. The non-transitory computer readable medium of claim 13 , further comprising, before determining, according to the index status information of the column in the database within the preset time threshold, whether an index is to be established for the column:

initializing the database;

constructing a first set of indexes for each column in the database according to a default index type; and

reconstructing a second set of indexes for each column after a preset period of time.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 21, 2026
From: ALIBABA GROUP HOLDING LIMITED
To: CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PRIVATE LIMITED
Reel/Frame 075478/0225 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 26, 2020
From: ZHENG, BOWEN; PAN, YUE; WEI, CHUANGXIAN
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 053048/0107 →
Priority Claims (1)
CN 201510868254.X · Dec 1, 2015 · national
Continuity (2)
Continuation PCTCN2016106581 · Nov 21, 2016
Related Publication 20180276264A1 · Sep 27, 2018