Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRxvs-0007rs-2I for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Apr 2020 12:59:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRxvq-0003vL-VC for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Apr 2020 12:59:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRxvq-0003vE-ON for pgsql-hackers@lists.postgresql.org; Fri, 24 Apr 2020 12:59:50 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jRxvo-0000RM-AY for pgsql-hackers@postgresql.org; Fri, 24 Apr 2020 12:59:50 +0000 Received: by mail-wm1-x32f.google.com with SMTP id r26so10623902wmh.0 for ; Fri, 24 Apr 2020 05:59:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:comments:mime-version :content-id:content-transfer-encoding:date:message-id; bh=i2h/0hDvDahP6nr4n+OmkFU6JsQjTrQFzuoGtHSBwf4=; b=pXY4rFXEnwJ6MrH8Hn8l9LP/QNd8SV5TtIVkQcs896I9p89B4IdLHub18WhOdm5Z1n t6Iv05IMIuKNUAquoTwlwblvTeItZwI4SLdCBFOZYo+e5oOFZ9dQ77N5lyw/4V3L+UYL +85YOqZmHy/lMZDbQsAs/ixlVchS6whUVim5sxhgvd0QLPh4/Ehk8kRog6R71dkPHnfi dus4q6OaYhNnr8bs+vaSdrtiwXs1crGEBypXVMxP6HIT2pQ0k1ClpG/ZozDZsqVvChJx uGceMAodd5dCsWqql9cXRKo7/ILFGkgLGl2uHrHy9Jcn0pjmPDAAtYIDTk2Gs5QuvfIl liCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :comments:mime-version:content-id:content-transfer-encoding:date :message-id; bh=i2h/0hDvDahP6nr4n+OmkFU6JsQjTrQFzuoGtHSBwf4=; b=WN0sAyzEP3cjIgYhbh9jyiT9r1DoM5TXbFzPreLIj0vF7A640WBq6oZp4DL6tyMt29 t1W7rIve+swiW85DwrnB4joN3wPzHNnbc9uUdgCuJSRbML6810P2leVvWAa0Zbo7LoQU sWgYiPaQhqELUHCHCleKIsi2scuSFoLt9U+vwVQqe/UBw+RW4BU723EaU2A2xMZKaPVB NAv51ElcnVb2vDUb7DfON0vrS5RXxvYbOMA9AeAUB/V4D2po6YYpyO/pxoCnxECkYU6h EZ5xL0jVDQsth4txWHdCICRdTh0AV9vUtynhbwDqdOqHq+2iR7HojttqM/XyrFTq2UjN dnoQ== X-Gm-Message-State: AGi0Pub0m4M4KaScRbm+0XJQgxNkK16WKBL00HAQEuNEnGUp/Fgz/DF2 VrZfjSa/0XzFy35JJ+vGOzbNaA== X-Google-Smtp-Source: APiQypJH4OxkYQRi6HHCYP9wzAMMtYNlieRuiBmv30YvoweKuaiP2oKQpVe9XZG8fBC0ZlwJIStQRA== X-Received: by 2002:a1c:40c4:: with SMTP id n187mr9685916wma.28.1587733187332; Fri, 24 Apr 2020 05:59:47 -0700 (PDT) Received: from antos ([77.87.240.5]) by smtp.gmail.com with ESMTPSA id q10sm7744807wrv.95.2020.04.24.05.59.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 05:59:46 -0700 (PDT) From: Antonin Houska To: Andy Fan cc: legrand legrand , pgsql-hackers Subject: Re: WIP: Aggregation push-down In-reply-to: References: <11172.1550780283@sss.pgh.pa.us> <23468.1551369774@localhost> <1897.1562680064@spoje.net> <13971.1562920911@spoje.net> <19857.1563374392@localhost> <20190904202339.GA13644@alvherre.pgsql> <7087.1567663858@localhost> <1582751446111-0.post@n3.nabble.com> <20715.1582793501@antos> Comments: In-reply-to Andy Fan message dated "Wed, 22 Apr 2020 11:39:58 +0800." X-Mailer: MH-E 8.6+git; nmh 1.7; GNU Emacs 26.3.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <51214.1587733269.1@antos> Content-Transfer-Encoding: quoted-printable Date: Fri, 24 Apr 2020 15:01:09 +0200 Message-ID: <51215.1587733269@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andy Fan wrote: > > 1) v14-0001-Introduce-RelInfoList-structure.patch > > ------------------------------------------------- > > = > > - I'm not entirely sure why we need this change. We had the list+hash > > before, so I assume we do this because we need the output functions? > = > I believe that this is what Tom proposed in [1], see "Maybe an appropri= ate > preliminary patch is to refactor the support code ..." near the end of = that > message. The point is that now we need two lists: one for "plain" relat= ions > and one for grouped ones. > = > = > I guess what Toms suggested[1] is to store the the grouped ones into = > root->upper_rels rather than a separated member, see fetch_upper_rel > or UpperRelationKind. If we do need the list+hash method for long list = lookup, = > we can merge it into upper_rels. If we want this benefits at other plac= e rather = > than root->upper_rels, we can store a generic type in RelInfoList, looks= currently > it is bounded to RelAggInfo besides RelOptInfo. But overall, personall= y I think we can = > ignore such optimization at the first stage to save the attention of the= core reviewers > since they are too precious :) Just FYI > = > [1] https://www.postgresql.org/message-id/9726.1542577439@sss.pgh.pa.us = Hm, you seem to be right, not sure why I missed the point. I thought that = the reason Tom doesn't like storing the grouped relations in simple_rel_array = is that we only need the grouped base relations inside query_planner(), but simple_rel_array is used higher in the stack. So I introduced a new field = and used it only in query_planner() and subroutines. Yes, it's better to use root->upper_rels than to introduce the new field. = I'll adjust the patch. Thanks. -- = Antonin Houska Web: https://www.cybertec-postgresql.com