Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-7942

Add query hints for cardinalities and selectivities

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Impala 3.2.0
    • None
    • Frontend
    • None
    • ghx-label-2

    Description

      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.

      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;
      

      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:

      select count(*) from T /*+ num_rows(100) */
        where id < 100 /*+ selectivity(0.1) */;
      

      This is a first step towards giving users more control over the planner / optimizer.

      Attachments

        Issue Links

          Activity

            People

              skyyws Sheng Wang
              lv Lars Volker
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: