impala-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Tauber-Marshall (Code Review)" <ger...@cloudera.org>
Subject [Impala-CR](cdh5-trunk) IMPALA-2805: Order filters based on selectivity and cost
Date Fri, 25 Mar 2016 18:44:23 GMT
Thomas Tauber-Marshall has posted comments on this change.

Change subject: IMPALA-2805: Order filters based on selectivity and cost
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/2598/1/fe/src/main/java/com/cloudera/impala/planner/PlanNode.java
File fe/src/main/java/com/cloudera/impala/planner/PlanNode.java:

Line 667:         double cost = e.getCost() + (totalCost - e.getCost()) * e.getSelectivity();
> Where is the data type used in cost formula? sorry I couldn't find it. 
It comes from NumericLiteral::computeCost, StringLiteral::computeCost, etc.

So in your example, "age in (10,12,13)"'s cost would be computed as:

cost = (in predicate cost)
= (children's cost) + (comparison cost) + (in cost)
= cost(age) + cost(10) + cost(12) + cost(13) + binary_predicate_cost * 3 + in_cost
= slot_ref_cost + int_literal_cost + int_literal_cost + int_literal_cost + binary_predicate_cost
* 3 + in_cost
= 5 + 1 + 1 + 1 + 1 * 3 + 5
= 16

and "city in ('NY', "SF")"'s cost would be:
cost = (in predicate cost)
= (children's cost) + (comparison cost) + (in cost)
= cost(city) + cost('New York') + cost('San Francisco') + binary_predicate_cost * 2 + in_cost
= slot_ref_cost + string_literal_cost + string_literal_cost + binary_predicate_cost * 2 +
in_cost
= 5 + 8 + 13 + 1 * 2 + 5
= 33

Of course, these estimates are not perfect, but they should give us better ordering than the
essentially random ordering that we have now.


-- 
To view, visit http://gerrit.cloudera.org:8080/2598
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I02279a26fbc6308ac5eb819d78345fc010469034
Gerrit-PatchSet: 1
Gerrit-Project: Impala
Gerrit-Branch: cdh5-trunk
Gerrit-Owner: Thomas Tauber-Marshall <tmarshall@cloudera.com>
Gerrit-Reviewer: Alex Behm <alex.behm@cloudera.com>
Gerrit-Reviewer: Marcel Kornacker <marcel@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj@cloudera.com>
Gerrit-Reviewer: Mostafa Mokhtar <mmokhtar@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tmarshall@cloudera.com>
Gerrit-HasComments: Yes

Mime
View raw message