Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-1626

Multiple global aggregations result in sub-optimal plan

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • COMP - Compiler

    Description

      query:

      Select count(*), avg(I_ID) 
      FROM  items;
      
      istribute result [%0->$$24]
      -- DISTRIBUTE_RESULT  |UNPARTITIONED|
        exchange
        -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
          project ([$$24])
          -- STREAM_PROJECT  |UNPARTITIONED|
            assign [$$24] <- [function-call: asterix:closed-record-constructor, Args:[AString: {$1}, function-call: asterix:sql-count, Args:[%0->$$19], AString: {$2}, function-call: asterix:sql-avg, Args:[%0->$$23]]]
            -- ASSIGN  |UNPARTITIONED|
              project ([$$19, $$23])
              -- STREAM_PROJECT  |UNPARTITIONED|
                subplan {
                          aggregate [$$23] <- [function-call: asterix:listify, Args:[%0->$$22]]
                          -- AGGREGATE  |UNPARTITIONED|
                            assign [$$22] <- [function-call: asterix:field-access-by-name, Args:[%0->$$27, AString: {I_ID}]]
                            -- ASSIGN  |UNPARTITIONED|
                              assign [$$27] <- [function-call: asterix:field-access-by-index, Args:[%0->$$12, AInt32: {0}]]
                              -- ASSIGN  |UNPARTITIONED|
                                unnest $$12 <- function-call: asterix:scan-collection, Args:[%0->$$15]
                                -- UNNEST  |UNPARTITIONED|
                                  nested tuple source
                                  -- NESTED_TUPLE_SOURCE  |UNPARTITIONED|
                       }
                -- SUBPLAN  |UNPARTITIONED|
                  project ([$$19, $$15])
                  -- STREAM_PROJECT  |UNPARTITIONED|
                    subplan {
                              aggregate [$$19] <- [function-call: asterix:listify, Args:[%0->$$18]]
                              -- AGGREGATE  |UNPARTITIONED|
                                unnest $$11 <- function-call: asterix:scan-collection, Args:[%0->$$15]
                                -- UNNEST  |UNPARTITIONED|
                                  nested tuple source
                                  -- NESTED_TUPLE_SOURCE  |UNPARTITIONED|
                           }
                    -- SUBPLAN  |UNPARTITIONED|
                      assign [$$18] <- [AInt64: {1}]
                      -- ASSIGN  |UNPARTITIONED|
                        aggregate [$$15] <- [function-call: asterix:listify, Args:[%0->$$10]]
                        -- AGGREGATE  |UNPARTITIONED|
                          exchange
                          -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
                            project ([$$10])
                            -- STREAM_PROJECT  |PARTITIONED|
                              assign [$$10] <- [function-call: asterix:closed-record-constructor, Args:[AString: {items}, %0->$$7]]
                              -- ASSIGN  |PARTITIONED|
                                project ([$$7])
                                -- STREAM_PROJECT  |PARTITIONED|
                                  exchange
                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                    data-scan []<-[$$25, $$7, $$26] <- CouchbaseAnalytics:items
                                    -- DATASOURCE_SCAN  |PARTITIONED|
                                      exchange
                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                        empty-tuple-source
                                        -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            buyingyi Yingyi Bu
            buyingyi Yingyi Bu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment