Mostafa Mokhtar created HIVE-7666: ------------------------------------- Summary: Join selectivity calculation should use exponential back-off for conjunction predicates Key: HIVE-7666 URL: https://issues.apache.org/jira/browse/HIVE-7666 Project: Hive Issue Type: Bug Components: CBO Affects Versions: 0.13.1 Reporter: Mostafa Mokhtar Assignee: Laljo John Pullokkaran Fix For: 0.14.0
Assuming dependency for predicate (number of column joins & filters) will almost always hurt us as implied correlations do actually exist. Currently HiveRelMdSelectivity.computeInnerJoinSelectivity uses to log to smoothen selectivity of conjunction predicates which results in un-optimal plans. The problem with log is that it still assumes dependency, For instance in TPC-DS Q17 store_sales has 6 join predicates which explains why stor_sales is in the wrong place in the plan. Change the algorithm to use exponential back-off : ndv(pe0) * ndv(pe1) ^(1/2) * ndv(pe2) ^(1/4) * ndv(pe3) ^(1/8) Opposed to : ndv(pex)*log(ndv(pe1))*log(ndv(pe2)) For TPC-DS Q17 store_sales has 6 inner join predicates if we assume selectivity of 0.7 for each join then join selectivity can end up being 6.24285E-05 which is too low and eventually results in an un-optimal plan. -- This message was sent by Atlassian JIRA (v6.2#6252)