US 12,079,181 B2
Efficient indexing for querying arrays in databases
Sitaram Vemulapalli, San Jose, CA (US); Raghupathi Keshava Murthy, Union City, CA (US); Stephen Ching-Sing Yen, Atherton, CA (US); and Abhinav Dangeti, San Francisco, CA (US)
Assigned to Couchbase, Inc., Santa Clara, CA (US)
Filed by Couchbase, Inc., Santa Clara, CA (US)
Filed on Aug. 15, 2022, as Appl. No. 17/888,341.
Application 17/888,341 is a continuation of application No. 15/930,351, filed on May 12, 2020, granted, now 11,416,458.
Prior Publication US 2022/0391367 A1, Dec. 8, 2022
This patent is subject to a terminal disclaimer.
Int. Cl. G06F 16/00 (2019.01); G06F 16/215 (2019.01); G06F 16/22 (2019.01); G06F 16/2453 (2019.01)
CPC G06F 16/215 (2019.01) [G06F 16/2264 (2019.01); G06F 16/2453 (2019.01)] 20 Claims
OG exemplary drawing
 
1. A method for optimizing queries of databases, the method comprising:
storing, by a database system, a set of documents in a data store, the set of documents comprising a plurality of fields, the plurality of fields including an array field, wherein the array field stores an array including a first instance of a value and a second instance of the value for a document from the set of documents;
storing, by the database system, a de-duplication index and a conventional index in an index store, the de-duplication index corresponding to the array field including a unique entry for the value, the unique entry including an identifier of the document;
receiving, by the database system from a client device, a query statement for querying the data store, the query statement specifying the value;
querying the data store based on the query statement, the querying comprising:
retrieving the conventional index and the de-duplication index stored in the index store;
comparing the de-duplication index and the conventional index based on a set of optimization criteria, wherein the comparing includes comparing costs associated with executing the query statement using the de-duplication index and the conventional index;
selecting, based on the comparing, the de-duplication index;
retrieving, using the de-duplication index, the document from the data store; and
providing the document to the client device.