Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fbOdH-0004k7-U5 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Jul 2018 11:10:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fbOdF-0001MX-1e for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Jul 2018 11:10:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fbOdE-0001MQ-Rf for pgsql-hackers@lists.postgresql.org; Fri, 06 Jul 2018 11:10:32 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fbOdB-00064f-Dz for pgsql-hackers@postgresql.org; Fri, 06 Jul 2018 11:10:32 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id DCC5341143; Fri, 6 Jul 2018 13:10:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id JZ-UXCVhqnJf; Fri, 6 Jul 2018 13:10:26 +0200 (CEST) From: Antonin Houska To: Robert Haas cc: "pgsql-hackers@postgresql.org" Subject: Re: [HACKERS] WIP: Aggregation push-down In-reply-to: References: <9666.1491295317@localhost> <8160.1493369169@localhost> <29613.1502983342@localhost> <14577.1509723225@localhost> <18007.1513957437@localhost> <20239.1516971866@localhost> <13114.1517214722@localhost> <26256.1519402083@localhost> Comments: In-reply-to Robert Haas message dated "Sat, 24 Feb 2018 09:08:07 -0500." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 06 Jul 2018 13:11:42 +0200 Message-ID: <11966.1530875502@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas wrote: > On Fri, Feb 23, 2018 at 11:08 AM, Antonin Houska wrote: > > I spent some more time thinking about this. What about adding a new str= ategy > > number for hash index operator classes, e.g. HTBinaryEqualStrategyNumbe= r? For > > most types both HTEqualStrategyNumber and HTBinaryEqualStrategyNumber s= trategy > > would point to the same operator, but types like numeric would naturall= y have > > them different. > > > > Thus the pushed-down partial aggregation can only use the > > HTBinaryEqualStrategyNumber's operator to compare grouping expressions.= In the > > initial version (until we have useful statistics for the binary values)= we can > > avoid the aggregation push-down if the grouping expression output type = has the > > two strategies implemented using different functions because, as you no= ted > > upthread, grouping based on binary equality can result in excessive num= ber of > > groups. > > > > One open question is whether the binary equality operator needs a separ= ate > > operator class or not. If an opclass cares only about the binary equali= ty, its > > hash function(s) can be a lot simpler. >=20 > Hmm. How about instead adding another regproc field to pg_type which > stores the OID of a function that tests binary equality for that > datatype? If that happens to be equal to the OID you got from the > opclass, then you're all set. I suppose you mean pg_operator, not pg_type. What I don't like about this is that the new field would only be useful for very little fraction of operators. On the other hand, the drawback of an additional operator classes is that w= e'd have to modify almost all the existing operator classes for the hash AM. (T= he absence of the new strategy number in an operator class cannot mean that the existing equality operator can be used to compare binary values too, because thus we can't guarantee correct behavior of the already existing user-defin= ed operator classes.) --=20 Antonin Houska Cybertec Sch=C3=B6nig & Sch=C3=B6nig GmbH Gr=C3=B6hrm=C3=BChlgasse 26, A-2700 Wiener Neustadt Web: https://www.cybertec-postgresql.com