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 1kJfF1-0005Kw-7g for pgsql-bugs@arkaria.postgresql.org; Sat, 19 Sep 2020 15:57:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kJfF0-0000hM-5V for pgsql-bugs@arkaria.postgresql.org; Sat, 19 Sep 2020 15:57:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJfEz-0000hF-Vp for pgsql-bugs@lists.postgresql.org; Sat, 19 Sep 2020 15:57:33 +0000 Received: from smtp87.ord1c.emailsrvr.com ([108.166.43.87]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJfEt-0002SW-Lf for pgsql-bugs@lists.postgresql.org; Sat, 19 Sep 2020 15:57:32 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp19.relay.ord1c.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id B7126A015B; Sat, 19 Sep 2020 11:57:25 -0400 (EDT) From: Christophe Pettus Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.5\)) Subject: Re: BUG #16625: Query Optimizer - Performance bug related to removal of unnecessary aggregate function Date: Sat, 19 Sep 2020 08:57:24 -0700 References: <16625-07403f18463add24@postgresql.org> To: xinyuliu@umich.edu, pgsql-bugs@lists.postgresql.org In-Reply-To: <16625-07403f18463add24@postgresql.org> Message-Id: <485F48DB-5655-434C-AAED-ACCD5B938CB4@thebuild.com> X-Mailer: Apple Mail (2.3445.9.5) X-Classification-ID: e7ac8ca1-3b5c-42cb-95e0-a22258719f6c-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Sep 18, 2020, at 20:32, PG Bug reporting form = wrote: [snip] > First query: > SELECT "s_suppkey"=20 > FROM "supplier"=20 > WHERE s_suppkey > 100; =20 >=20 > Second query: > SELECT "s_suppkey"=20 > FROM "supplier"=20 > WHERE s_suppkey > 100=20 > GROUP BY s_suppkey;=20 [snip] > [Expected Behavior] > Since these two queries are semantically equivalent, we were hoping = that > PostgreSQL will return the same results in roughly the same amount of > time. These two queries are not semantically equivalent, as described. I = might guess that the table definition has a primary key (or should have = had) on "supplier"."s_suppkey", and thus the GROUP BY should be = redundant, but there's nothing in the report or the query plans that = indicate this is the case. -- -- Christophe Pettus xof@thebuild.com