[ 
https://issues.apache.org/jira/browse/IMPALA-1270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17155799#comment-17155799
 ] 

Tim Armstrong edited comment on IMPALA-1270 at 7/10/20, 11:51 PM:
------------------------------------------------------------------

I don't think the distinct rewrite actually helps here, per Marcel's point - 
the semi join is better as far as I can tell. Maybe we'd be better off 
broadcasting. I think the general point about adding the distinct to the 
subquery, if it would reduce the cardinality, is worth thinking about so 
repurposing the JIRA for that.


was (Author: tarmstrong):
I don't think the distinct rewrite actually helps here, per Marcel's point - 
the semi join helps. Maybe we'd be better off broadcasting. I think the general 
point about adding the distinct to the subquery is worth thinking about.

> Consider adding distinct aggregation to subqueries as perf optimization
> -----------------------------------------------------------------------
>
>                 Key: IMPALA-1270
>                 URL: https://issues.apache.org/jira/browse/IMPALA-1270
>             Project: IMPALA
>          Issue Type: Task
>          Components: Frontend
>    Affects Versions: Impala 2.0
>            Reporter: Nong Li
>            Priority: Minor
>              Labels: planner
>
> We should consider other rewrites for exists. For q4, another rewrite is an 
> inner join + distinct:
> {code}
> select
>   o_orderpriority,
>   count(distinct l_orderkey) as order_count
> from lineitem l
> inner join orders o
>   on (o.o_orderkey = l.l_orderkey and
>       l.l_commitdate < l.l_receiptdate)
> where
>   o_orderdate >= '1993-07-01' and
>   o_orderdate < '1993-10-01'
> group by
>   o_orderpriority
> order by
>   o_orderpriority
> {code}
> This can run much faster because we have more flexibility on how we execute 
> the inner join. We get killed partitioning lineitem now.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to