IP Library › Granted Patent US 12,361,007
Granted Patent B2
US 12,361,007 · App. 18/062,408 · Granted Jul 15, 2025

Apparatus, method and storage medium for database query

Inventors: Chao Xie (San Francisco, CA); Chao Gao (Shanghai, CN); Qianya Cheng (Shanghai, CN); Xiaomeng Yi (Shanghai, CN)
G06F16/24556G06F16/248G06F16/27G06F16/285
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 12,361,007
App. No.
18/062,408
Filed
Dec 6, 2022
Granted
Jul 15, 2025
Kind
B2
Art Unit
2151
USPC
707/722
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.

Claims (87)

1. 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 parameter prediction model, the parameter prediction model is used to conduct a preset calculation on a sequence of query vectors corresponding to the query request via Hidden layer after acquiring the sequence of query vectors from input layer, and then output the number of query results corresponding to each shard, the query result comprises a first query result, the query parameters comprise a first 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, comprising:

performing query result prediction on first data in each shard based on the number of the first query result indicated by the query request using the parameter prediction model to obtain a first predicted number of first query results in each shard, wherein the first data is used to indicate inventory data which is clustered and be stored in shards, and the sum of the first prediction number corresponding to each shard is equal to the number of the first query result;

acquiring a preset correspondence between the predicted number and the query parameters; and

determining a first query parameter corresponding to each shard according to the preset correspondence and the first predicted number.

2. 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.

3. 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.

4. 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.

5. 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.

6. 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.

7. 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.

8. 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.

9. The apparatus according to claim 6 , wherein

querying database data in each shard based on the query request and the query parameters to obtain a target query result comprises:

querying first data in each shard based on the query request and the first query parameter to obtain a first query result;

querying second data in each new shard based on the query request and the second query parameter to obtain a second query result; and

aggregating the first query result and the second query result to obtain a target query result.

10. The apparatus according to claim 1 , further comprising:

determining at least one query shard according to the first predicted number.

11. The apparatus according to claim 10 , wherein

querying database data in each shard based on the query request and the query parameters to obtain a target query result comprises:

querying database data in each of the at least one query shard based on the query request and query parameters to obtain a target query result.

12. A method performed by at least one processor, comprising:

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, wherein the database data is stored in vector database; 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 parameter prediction model, the parameter prediction model is used to conduct a preset calculation on a sequence of query vectors corresponding to the query request via Hidden layer after acquiring the sequence of query vectors from input layer, and then output the number of query results corresponding to each shard, the query result comprises a first query result, the query parameters comprise a first 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, comprising:

performing query result prediction on first data in each shard based on the number of the first query result indicated by the query request using the parameter prediction model to obtain a first predicted number of first query results in each shard, wherein the first data is used to indicate inventory data which is clustered and be stored in shards, and the sum of the first prediction number corresponding to each shard is equal to the number of the first query result;

acquiring a preset correspondence between the predicted number and the query parameters; and

determining a first query parameter corresponding to each shard according to the preset correspondence and the first predicted number.

13. A computer-readable storage medium having stored thereon instructions that, when executed on an electronic device, cause the electronic device to perform a method comprising:

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, wherein the database data is stored in vector database; 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 parameter prediction model, the parameter prediction model is used to conduct a preset calculation on a sequence of query vectors corresponding to the query request via Hidden layer after acquiring the sequence of query vectors from input layer, and then output the number of query results corresponding to each shard, the query result comprises a first query result, the query parameter comprise a first 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, comprising:

performing query result prediction on first data in each shard based on the number of the first query result indicated by the query request using the parameter prediction model to obtain a first predicted number of first query results in each shard, wherein the first data is used to indicate inventory data which is clustered and be stored in shards, and the sum of the first prediction number corresponding to each shard is equal to the number of the first query result;

acquiring a preset correspondence between the predicted number and the query parameters; and

determining a first query parameter corresponding to each shard according to the preset correspondence and the first predicted number.

14. The storage medium according to claim 13 , wherein

determining a first query parameter corresponding to each shard according to the preset correspondence and the first predicted number comprises any one of:

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: or

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.

15. The storage medium according to claim 13 , wherein

the database data includes second data indicating incremental data which is not clustered and be stored in the respective shards in chronological order, and

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.

16. The storage medium according to claim 15 , 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 any one of:

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: or

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.

17. The storage medium according to claim 16 , 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.

18. The storage medium according to claim 16 , wherein

querying database data in each shard based on the query request and the query parameters to obtain a target query result comprises:

querying first data in each shard based on the query request and the first query parameter to obtain a first query result;

querying second data in each new shard based on the query request and the second query parameter to obtain a second query result; and

aggregating the first query result and the second query result to obtain a target query result.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 6, 2022
From: XIE, CHAO; GAO, CHAO; CHENG, QIANYA; YI, XIAOMENG
To: ZILLIZ INC.
Reel/Frame 062000/0268 →
Continuity (1)
Related Publication 20240184784A1 · Jun 6, 2024
References Cited (23)
US 11042538B2 · Braundmeier · 2021 [cited by examiner]
US 11360982B1 · Liu · 2022 [cited by examiner]
US 20070276802A1 · Piedmonte · 2007 [cited by applicant]
US 20170091269A1 · Zhu et al. · 2017 [cited by applicant]
US 20170213257A1 · Murugesan et al. · 2017 [cited by applicant]
US 20190026336A1 · Tian · 2019 [cited by applicant]
US 20200065412A1 · Braundmeier · 2020 [cited by examiner]
US 20210035020A1 · Boulineau et al. · 2021 [cited by applicant]
US 20220036123A1 · Cummings et al. · 2022 [cited by applicant]
US 20230409889A1 · Haykal et al. · 2023 [cited by applicant]
CN 112905595A · 2021 [cited by applicant]
CN 113449132B · 2022 [cited by applicant]
CN 114329094A · 2022 [cited by applicant]
WO 2022177150A1 · 2022 [cited by applicant]
United States Patent and Trademark Office, Office Action in related U.S. Appl. No. 18/054,323, filed Mar. 1, 2024. [cited by applicant]
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. [cited by applicant]
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). [cited by applicant]
Tao et al. “Query-level loss functions for information retrieval”, Mar. 2008, https://www.sciencedirect.com/science/article/pii/ S0306457307001276 (Year: 2008). [cited by applicant]
Sun et al. “Learned Cardinality Estimation for Similarity Qeries”, Jun. 25, 2021, https://dl.acm.org/doi/pdf/10.1145/3448016.3452790 (Year: 2021). [cited by applicant]
Yang et al. “Deep Unsupervised Cardinality Estimation”, 2019, https://vldb.org/pvldb/vol13/p279-yang.pdf (Year: 2019). [cited by applicant]
Zheng et al. “Learned Probing Cardinality Estimation for High-Dimensional Approximate NN Search”, 2023, https://ieeexplore. ieee.org/stamp/stamp.jsp?arnumber=10184837 &tag= 1 (Year: 2023). [cited by applicant]
United States Patent and Trademark Office, Office Action issued in related U.S. Appl. No. 17/931,671 dated Aug. 9, 2024. [cited by applicant]
United States Patent and Trademark Office, Office Action issued in related U.S. Appl. No. 18/054,323 dated Sep. 10, 2024. [cited by applicant]