Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-10305

SQL: Optimize query execution if it targets only one or none partitions

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.8
    • sql

    Description

      This is a part of "Partition Pruning" IEP [1].

      Currently we try to extract partitions from map queries and route requests accordingly. Several problems with this approach:
      1) Individual map queries may target the same partition, but we never know that, so we may want to setup a merge table when it is not really needed.
      2) Sometimes query may reduce to no partitions. In this case we should not execute anything at all and simply return empty result set.
      3) If the whole query targets only one partition, we may skip the whole splitter phase!

      I propose to do the following:

      1. Try to extract partition from "original" query.
      2. If we see that exactly one partition is involved, then original query is a map query, and reduce should be performed in "skip merge table" mode
      3. If we see that there are no partitions because query is invalid (e.g. id = 1 AND id = 2), then stop and return no results. This decision should be cached in two-step plan.
      4. If we see that there are some partitions, then we should apply arguments and see the result. If result set is empty - return, but do not cache empty result set decision, as it may change for another set of arguments.
      5. If none of above hold, then do pushdowns and split, and analyze partitions of individual map queries. For those of them where partition set is empty, we should return empty result set without executing anything.

      [1] https://cwiki.apache.org/confluence/display/IGNITE/IEP-24%3A+SQL+Partition+Pruning

      Attachments

        Issue Links

          Activity

            People

              alapin Alexander Lapin
              vozerov Vladimir Ozerov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m