US 11,709,831 B2
Cost-based query optimization for array fields in database systems
Bingjie Miao, Englewood, CO (US); Raghupathi Keshava Murthy, Union City, CA (US); Marco Greco, Birchanger (GB); and Prathibha Bisarahalli Prabhakar, Bangalore (IN)
Assigned to COUCHBASE, INC., Santa Clara, CA (US)
Filed by Couchbase, Inc., Santa Clara, CA (US)
Filed on Apr. 1, 2022, as Appl. No. 17/711,982.
Application 17/711,982 is a continuation of application No. 16/788,923, filed on Feb. 12, 2020, granted, now 11,294,896.
Claims priority of application No. 201941032385 (IN), filed on Aug. 9, 2019.
Prior Publication US 2022/0222250 A1, Jul. 14, 2022
This patent is subject to a terminal disclaimer.
Int. Cl. G06F 7/02 (2006.01); G06F 16/00 (2019.01); G06F 16/2453 (2019.01); G06F 16/93 (2019.01); G06F 16/2457 (2019.01); G06F 16/2458 (2019.01)
CPC G06F 16/2453 (2019.01) [G06F 16/2462 (2019.01); G06F 16/24578 (2019.01); G06F 16/93 (2019.01)] 20 Claims
OG exemplary drawing
 
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.