Re: BUG #16625: Query Optimizer - Performance bug related to removal of unnecessary aggregate function

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: xinyuliu(at)umich(dot)edu, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16625: Query Optimizer - Performance bug related to removal of unnecessary aggregate function
Date: 2020-09-19 15:57:24
Message-ID: 485F48DB-5655-434C-AAED-ACCD5B938CB4@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On Sep 18, 2020, at 20:32, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:
[snip]
> First query:
> SELECT "s_suppkey"
> FROM "supplier"
> WHERE s_suppkey > 100;
>
> Second query:
> SELECT "s_suppkey"
> FROM "supplier"
> WHERE s_suppkey > 100
> GROUP BY s_suppkey;

[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(at)thebuild(dot)com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Xinyu Liu 2020-09-19 16:05:39 Re: BUG #16625: Query Optimizer - Performance bug related to removal of unnecessary aggregate function
Previous Message PG Bug reporting form 2020-09-19 03:32:41 BUG #16625: Query Optimizer - Performance bug related to removal of unnecessary aggregate function