US 11,880,366 B2
Index-based, adaptive join size estimation
Yogi Joshi, Waterloo (CA); Sergiu Pocol, Kitchener (CA); David DeHaan, Burlington (CA); Daniel Farrar, Kitchener (CA); and Anisoara Nica, Waterloo (CA)
Assigned to SAP SE, Walldorf (DE)
Filed by SAP SE, Walldorf (DE)
Filed on May 18, 2021, as Appl. No. 17/323,867.
Prior Publication US 2022/0382757 A1, Dec. 1, 2022
Int. Cl. G06F 16/2453 (2019.01)
CPC G06F 16/24544 (2019.01) [G06F 16/24537 (2019.01)] 18 Claims
OG exemplary drawing
 
1. A method of estimating join size, the method comprising:
(a) applying a filter to a first table in a join operation between the first table and a second table and generating a filter output;
(b) based on a sample size, sampling the filter output to generate a filtered sample, the filtered sample comprising a plurality of records from the filter output;
(c) for the plurality of records in the filtered sample, accessing an index for the second table and retrieving counts of records in the second table corresponding to the plurality of records in the filtered sample;
iterating (b)-(c) with a new value for the sample size until a statistical confidence in a join factor based on the counts of records and sample size has been reached;
estimating a data size for the join operation based on the counts of records in the second table corresponding to the plurality of records in the filtered sample; and
based on the estimated data size for the join operation, determining or modifying a query execution plan as part of query optimization for a query comprising the join operation.