Patent ID: 7747609

Claim:
A method for deriving join cost demographics for a binary join in a query, the binary join being between a first relation having a first join column and a second relation having a second join column, the method comprising: determining a number (“A 1 ”) of unique first join column values stored in each of a first plurality of units of storage; determining a correlation factor (“C 1 ”) related to the ratio of A 1 to the total number of unique values in the first join column; determining a number (“A 2 ”) of unique second join column values stored in each of a second plurality of units of storage; determining a correlation factor (“C 2 ”) related to the ratio of A 2 to the total number of unique values in the second join column; adjusting C 1 and C 2 by a number of units of storage that are qualified to participate in the binary join; determining a number (“B 1 ”) of first join column values that will participate in the binary join based on A 1 ; determining a number (“B 2 ”) of second join column values that will participate in the binary join based on A 2 ; selecting the smaller of B 1 and B 2 as B f ; adjusting B f by C 1 and C 2 ; and storing A 1 , A 2 , and B f as join cost demographics for the two join columns.