CPC G06F 16/215 (2019.01) [G06F 16/2264 (2019.01); G06F 16/2453 (2019.01)] | 20 Claims |
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.
|