Generating an index for a table in a database background
First Claim
1. A computer implemented method for managing a database to increase response efficiency of a database system, the method comprising:
- receiving a query statement to query a table in the database, wherein the query statement includes a table identifier and a query condition;
searching the table identified by the table identifier for a plurality of lines that satisfy the query condition in the query statement;
generating a result list based on line identifiers of one or more lines in the plurality of lines that satisfy the query condition;
generating a hash value based on the table identifier and the query condition, wherein the hash value is associated with the line identifiers of the result list;
generating a flag associated with a line validity state associated with line modification, wherein an initial condition of the validity state indicated by the flag is valid;
mapping the flag to each line identifier of the generated result list;
generating an index for the query statement, wherein the index comprises one or more lines in the plurality of lines associated with the results list and information associated with the result list and the query condition, the hash value, and the mapped flag, wherein the number of lines associated with the result list is compressed using a data storage technique when the number of lines is larger than a pre-configured threshold value, wherein the index is manually generated when a keyword is added at the end of the query statement to indicate the index is to be generated manually or the index is automatically generated in response to determining the query condition in a previous query statement matches at least one part of the second condition in a subsequent second statement; and
using the generated index to respond to a received data query statement querying data in the database.
1 Assignment
0 Petitions
Accused Products
Abstract
Embodiments of the present invention disclose a method, computer program product, and system for generating and manipulating an index for a table in a database. A query statement is received, the table of lines are searched, a result list is generated, and an index for the query statement is generated, wherein the index comprises information associated with the result list and the query condition. The query condition and the identifier of the table is extracted from the query statement, where the index is generated based on the query condition, the identifier of the table, and the result list. A hash value of the identifier of the table and the query condition is obtained, an association between the hash value and the result list to build the index is generated, and in response to a line of the plurality of lines in the table being modified, the index identified as invalid.
-
Citations
18 Claims
-
1. A computer implemented method for managing a database to increase response efficiency of a database system, the method comprising:
-
receiving a query statement to query a table in the database, wherein the query statement includes a table identifier and a query condition; searching the table identified by the table identifier for a plurality of lines that satisfy the query condition in the query statement; generating a result list based on line identifiers of one or more lines in the plurality of lines that satisfy the query condition; generating a hash value based on the table identifier and the query condition, wherein the hash value is associated with the line identifiers of the result list; generating a flag associated with a line validity state associated with line modification, wherein an initial condition of the validity state indicated by the flag is valid; mapping the flag to each line identifier of the generated result list; generating an index for the query statement, wherein the index comprises one or more lines in the plurality of lines associated with the results list and information associated with the result list and the query condition, the hash value, and the mapped flag, wherein the number of lines associated with the result list is compressed using a data storage technique when the number of lines is larger than a pre-configured threshold value, wherein the index is manually generated when a keyword is added at the end of the query statement to indicate the index is to be generated manually or the index is automatically generated in response to determining the query condition in a previous query statement matches at least one part of the second condition in a subsequent second statement; and using the generated index to respond to a received data query statement querying data in the database. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A computer system for managing a database to increase response efficiency of a database system, the computer system comprising:
-
one or more computer processors; a computer-readable storage media; program instructions stored on the computer-readable storage media for execution by at least one of the one or more processors, the program instructions comprising; in response to receiving a query statement to query the table in the database, wherein the query statement includes a table identifier and a query condition, executing instructions to search the table identified by the table identifier for a plurality of lines that satisfy the query condition in the query statement; instructions to generate a result list based on line identifiers of the one or more lines in the plurality of lines that satisfy the query condition; instructions to generate a hash value based on the table identifier and the query condition, wherein the hash value is associated with the line identifiers of the result list; instructions to generate a flag associated with a line validity state associated with line modification, wherein an initial condition of the validity state indicated by the flag is valid; instructions to map the flag to each line identifier of the generated result list; instructions to generate the index for the query statement, wherein the index comprises one or more lines in the plurality of lines associated with the results list and information associated with the result list and the query condition, the hash value, and the mapped flag, wherein the number of lines associated with the result list is compressed using a data storage technique when the number of lines is larger than a pre-configured threshold value, wherein the index is manually generated when a keyword is added at the end of the query statement to indicate the index is to be generated manually or the index is automatically generated in response to determining the query condition in a previous query statement matches at least one part of the second condition in a subsequent second statement; and instructions to use the generated index to respond to a received data query statement querying data in the database. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17)
-
-
18. A computer program product for managing a database to increase response efficiency of a database system, the computer program product comprising:
-
one or more non-transitory computer-readable storage media and program instructions stored on the one or more computer-readable storage media, the program instructions comprising; in response to receiving a query statement to query the table in the database, wherein the query statement includes a table identifier and a query condition, executing instructions to search the table identified by the table identifier for a plurality of lines that satisfy the query condition in the query statement; instructions to generate a result list based on line identifiers of the one or more lines in the plurality of lines that satisfy the query condition; instructions to generate a hash value based on the table identifier and the query condition, wherein the hash value is associated with the line identifiers of the result list; instructions to generate a flag associated with a line validity state associated with line modification, wherein an initial condition of the validity state indicated by the flag is valid; instructions to map the flag to each line identifier of the generated result list; instructions to generate the index for the query statement, wherein the index comprises one or more lines in the plurality of lines associated with the results list and information associated with the query condition, the hash value, and the mapped flag, wherein the number of lines associated with the result list is compressed using a data storage technique when the number of lines is larger than a pre-configured threshold value, wherein the index is manually generated when a keyword is added at the end of the query statement to indicate the index is to be generated manually or the index is automatically generated in response to determining the query condition in a previous query statement matches at least one part of the second condition in a subsequent second statement; and instructions to use the generated index to respond to a received data query statement querying data in the database.
-
Specification