System, method, and apparatus for querying a database
Abstract
A database system as well as a method and an apparatus for querying a database are disclosed herein. In one embodiment, a system comprises a master database, at least one slave database, and a query processing unit. The master database has a data connection with the slave database, and the slave database has a data connection with the query processing unit. The query processing unit is configured to split a query request into query operation instructions having non-overlapping query ranges, send the split query operation instructions to the same or different slave databases to perform the query operations, and return the query results. The disclosed embodiments improve query efficiency.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1. A method comprising:
receiving, by a processor, a query request for a database from a requester;
splitting, by the processor, the query request into a plurality of query operation instructions having non-overlapping query ranges based on distributed column values corresponding to a query object corresponding to the query request;
issuing, by the processor, the plurality of query operation instructions to corresponding slave databases, the corresponding slave databases returning different records responsive to a received query operation instruction; and
returning, by the processor, a result of the query request to the requester, the result generated based on the issuing of the plurality of query operation instructions.
2. The method of claim 1 , the splitting the query request based on the distributed column values comprising splitting the query request based on values selected from the group consisting of pre-saved distributed column values of the query object; values of a column of the query object; values of a first column of the query object; and values of a column specified by the query request.
3. The method of claim 1 , the splitting the query request comprising splitting the query request based on unique keys of records of a query object corresponding to the query request.
4. The method of claim 1 , the splitting the query request comprising splitting the query request based on numbers of data pages of a query object corresponding to the query request.
5. The method of claim 1 , the issuing each of the plurality of query operation instructions comprising determining a number of slave databases participating in the query according to statistical information of data involved in the query and issuing the query operation instructions on the determined slave databases.
6. The method of claim 1 , further comprising generating the result by integrating return values of each of the plurality of query operation instructions.
7. A device comprising:
a processor; and
a storage medium for tangibly storing thereon program logic for execution by the processor, the stored program logic causing the processor to perform the operations of:
receiving, by a processor, a query request for a database from a requester;
splitting, by the processor, the query request into a plurality of query operation instructions having non-overlapping query ranges based on distributed column values corresponding to a query object corresponding to the query request;
issuing, by the processor, the plurality of query operation instructions to corresponding slave databases, the corresponding slave databases returning different records responsive to a received query operation instruction; and
returning, by the processor, a result of the query request to the requester, the result generated based on the issuing of the plurality of query operation instructions.
8. The device of claim 7 , the splitting the query request based on the distributed column values comprising splitting the query request based on values selected from the group consisting of pre-saved distributed column values of the query object; values of a column of the query object; values of a first column of the query object; and values of a column specified by the query request.
9. The device of claim 7 , the splitting the query request comprising splitting the query request based on unique keys of records of a query object corresponding to the query request.
10. The device of claim 7 , the splitting the query request comprising splitting the query request based on numbers of data pages of a query object corresponding to the query request.
11. The device of claim 7 , the issuing each of the plurality of query operation instructions comprising determining a number of slave databases participating in the query according to statistical information of data involved in the query and issuing the query operation instructions on the determined slave databases.
12. A non-transitory computer-readable storage medium for tangibly storing computer program instructions capable of being executed by a computer processor, the computer program instructions defining the steps of:
receiving, by a processor, a query request for a database from a requester;
splitting, by the processor, the query request into a plurality of query operation instructions having non-overlapping query ranges based on distributed column values corresponding to a query object corresponding to the query request;
issuing, by the processor, the plurality of query operation instructions to corresponding slave databases, the corresponding slave databases returning different records responsive to a received query operation instruction; and
returning, by the processor, a result of the query request to the requester, the result generated based on the issuing of the plurality of query operation instructions.
13. The computer-readable storage medium of claim 12 , the splitting the query request based on the distributed column values comprising splitting the query request based on values selected from the group consisting of pre-saved distributed column values of the query object; values of a column of the query object; values of a first column of the query object; and values of a column specified by the query request.
14. The computer-readable storage medium of claim 12 , the splitting the query request comprising splitting the query request based on unique keys of records of a query object corresponding to the query request.
15. The computer-readable storage medium of claim 12 , the splitting the query request comprising splitting the query request based on numbers of data pages of a query object corresponding to the query request.
16. The computer-readable storage medium of claim 12 , the issuing each of the plurality of query operation instructions comprising determining a number of slave databases participating in the query according to statistical information of data involved in the query and issuing the query operation instructions on the determined slave databases.
17. The computer-readable storage medium of claim 12 , the computer program instructions further defining the step of generating the result by integrating return values of each of the plurality of query operation instructions.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.