You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Sheng Wang (Jira)" <ji...@apache.org> on 2021/11/04 06:34:00 UTC

[jira] [Comment Edited] (IMPALA-7942) Add query hints for cardinalities and selectivities

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

Sheng Wang edited comment on IMPALA-7942 at 11/4/21, 6:33 AM:
--------------------------------------------------------------

Hi [~stigahuang], these kinds of hints is quite useful, since Impala's estimation for compute predicate selectivity for is simple without histograms. We can set cardinalities and selectivities manually to get better planner in some cases. I will assign this Jira to me and try to do.


was (Author: skyyws):
These kinds of hints is quite useful, since Impala's estimation for compute predicate selectivity for is simple without histograms. We can set cardinalities and selectivities manually to get better planner in some cases. I will assign this Jira to me and try to do. [~stigahuang]

> Add query hints for cardinalities and selectivities
> ---------------------------------------------------
>
>                 Key: IMPALA-7942
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7942
>             Project: IMPALA
>          Issue Type: New Feature
>          Components: Frontend
>    Affects Versions: Impala 3.2.0
>            Reporter: Lars Volker
>            Priority: Major
>
> The optimizer can pick suboptimal plans when tables don't have statistics. To allow users to help the optimizer, we should support query hints to specify cardinalities of scans, predicated (and possibly joins).
> This could look like the following example.
> {code:sql}
> select x from medium /*+ num_rows(1000000000) */
>   join small /*+ num_rows(1000000) */
>   join (select * from big /*+ num_rows(1000000000) */
>         where c1 < 10 /*+ selectivity(0.00001) */) as big
>   where medium.id = small.id and small.id = big.id;
> {code}
> Instead of cardinalities we could also support specifying the number of rows that pass a predicate (or join).
> We should not rely on the specified cardinalities to be accurate, e.g. the following should still execute a scan:
> {code:sql}
> select count(*) from T /*+ num_rows(100) */
>   where id < 100 /*+ selectivity(0.1) */;
> {code}
> This is a first step towards giving users more control over the planner / optimizer.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org