Apparatus, method and storage medium for database query
Abstract
The present disclosure relates to the field of computers, and provides an apparatus, a method, and a storage medium for database query, which are applied to a vector database, by acquiring a query request from a user, determining query parameters corresponding to each of multiple shards based on the query request using a preset neural network model, wherein the query parameters control query complexity by affecting a query range of database data of the query request for the corresponding shard; querying database data in each shard based on the query request and the query parameters to obtain a target query result. Accordingly, corresponding query parameters are adjusted for each shard, so that redundant queries are effectively avoided, and database performance is effectively improved.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 14 · Forward citations: 0.
Claims (8)
- Claim 1Independent Claim
An apparatus comprising: a memory for storing database data, wherein the database data is stored in vector database, the database data including multiple shards, wherein at least a part of multiple shards is determined by clustering the database data in a preset manner; and a processor configured to perform following processes, including: acquiring a query request from a user; determining query parameters which are corresponding to each of multiple shards based on the query request using a preset neural network model, wherein the query parameters control query complexity by affecting a query range of database data of the query request for the corresponding shard, wherein the query range indicates number of query results of the query request for corresponding shard; and querying database data in each shard based on the query request and the query parameters to obtain a target query result; wherein the database data comprises first data, the preset neural network model comprises a parame
- Claim 2Depends on #1
The apparatus according to claim 1, wherein determining a first query parameter corresponding to each shard according to the preset correspondence and the first predicted number comprises: generating a preset mapping table based on the preset correspondence between the predicted number and the query parameter, and determining a first query parameter corresponding to each shard according to the first predicted number and the preset mapping table.
- Claim 3Depends on #1
The apparatus according to claim 1, wherein determining a first query parameter corresponding to each shard according to the preset correspondence and the first predicted number comprises: determining a weighting coefficient based on the preset correspondence between the predicted number and the query parameter, and calculating the first predicted number based on the weighting coefficient to determine a first query parameter corresponding to each shard.
- Claim 4Depends on #1
The apparatus according to any one according to claim 1, wherein the database data includes second data indicating incremental data which is not clustered and be stored in the respective shards in chronological order.
- Claim 5Depends on #4
The apparatus according to claim 4, wherein determining a first query parameter corresponding to each shard according to the preset correspondence and the first predicted number further comprises: storing the first query parameter as a history query parameter; determining the second data in a preset time period, and storing the second data into shards after clustering to obtain updated first data in each shard; and using the preset neural network model to reconfirm the first query parameter based on the updated first data and the query request.
- Claim 6Depends on #5
The apparatus according to claim 5, wherein the preset neural network model comprises a sequence learning model, the query result comprises a second query result, the query parameter comprises a second query parameter, and further determining query parameters which are corresponding to each of multiple shards based on the query request using a preset neural network model comprises: determining the number of new shards that the second data stored in is greater than a preset threshold value, and using the sequence learning model to determine the second query parameter of each new shard based on the query request and the historical query parameter.
- Claim 7Depends on #5
The apparatus according to claim 5, wherein the preset neural network model comprises a sequence learning model, the query result comprises a second query result, the query parameter comprises a second query parameter, and further determining query parameters which are corresponding to each of multiple shards based on the query request using a preset neural network model comprises: determining the number of new shards that the second data stored in is less than or equal to a preset threshold value, using the historical query parameter to train the parameter prediction model, and using the trained parameter prediction model to determine the second query parameter of each new shard based on the query request.
- Claim 8Depends on #7
The apparatus according to claim 7, wherein using the trained parameter prediction model to determine the second query parameter of each new shard based on the query request comprises: performing query result prediction on the second data in each new shard based on the query request using the trained parameter prediction model to obtain a second predicted number of the second query result in each new shard; acquiring a preset correspondence between the predicted number and the query parameter, and determining the second query parameter which is corresponding to each new shard according to the second predicted number and the preset correspondence.
Technical Overview & Description
TECHNICAL FIELD The present disclosure relates to the field of computers, and more particularly, to an apparatus, method, and storage medium for database query. BACKGROUND In a data query for a database, query parameters may be used to determine the number of corresponding query indexes, in order to control query granularity and query accuracy. In the prior art, for example, a data query applied to a vector database uses the same query parameters for all query vectors. However, the query range required for query results found in the index by different query vectors is different. It could be understood that a simple query requires less data to be queried and results can be found quickly: and complex queries require a large range of data to be queried. Therefore, in the prior art, setting the same query parameters for all query vectors causes a large number of redundant queries, resulting in poor query performance. SUMMARY The following examples pertain to embodiments described throughout this disclosure. One or more embodiments can include an apparatus. The apparatus includes a memory for storing database data and a processor. The processor is configured to perform following processes, including: acquiring a query request from a user: determining query parameters which are corresponding to each of multiple shards based on the query request using a preset neural network model, wherein the query parameters control query complexity by affecting a query range of database data of the query request for the corresponding shard: and querying database data in each shard based on the query request and the query parameters to obtain a target query result. In some embodiments, the database data is stored under different shards so that query calculations of the database may be distributed into shards, and then query calculations may be performed on multiple shards at the same time so that query calculations of the database become efficient. Moreover, at least part of the shards i
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.
References Cited — Backward Prior Art (14)
| Patent | Title | Year | Citations |
|---|
Non-Patent Literature (10)
- United States Patent and Trademark Office, Office Action in related U.S. Appl. No. 18/054,323, filed Mar. 1, 2024.
- Conglong Li, Improving Approximate Nearest Neighbor Search through Learned Adaptive Early Termination, Research 29: Data Mining and Similarity Search, Jun. 14-19, 2020, p. 2539-2554, Portland, OR.
- Marcus et al.
- “
- Plan-Structured Deep Neural Network Models for Query Performance Prediction
- ”
- , 2019, https://www.vidb.org/pvldb/ vol12/p1733-marcus.pdf (Year: 2019).
- Tao et al.
- “
- Query-level loss functions for information retrieval