CPC G06F 16/2453 (2019.01) [G06F 16/2462 (2019.01); G06F 16/24578 (2019.01); G06F 16/93 (2019.01)] | 20 Claims |
1. A method for optimizing queries, the method comprising:
storing, a collection of documents in a database, wherein a document comprises an array field configured to store a plurality of elements;
generating a histogram for the array field, the histogram describing a distribution of the plurality of elements of the array field;
receiving a query statement specifying an expression based on the array field;
assigning a cost to each operator of a plurality of operators based on the histogram;
comparing the costs assigned to the plurality of operators;
generating, based on the comparison, a query execution plan; and
querying the database using the query execution plan.
|