From: Tom Lane <tgl@sss.pgh.pa.us>
To: liuxy@gatech.edu
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16888: Reoccurring group by clauses makes system slower
Date: Tue, 23 Feb 2021 10:12:13 -0500
Message-ID: <3821998.1614093133@sss.pgh.pa.us> (raw)
In-Reply-To: <16888-05b803340050f901@postgresql.org>
References: <16888-05b803340050f901@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> We have 2 TPC-H queries which fetch the same tuples but have significant
> query execution time differences (3.8 times).
> ...
> Since these two queries are semantically equivalent, we were hoping that
> PostgreSQL will evaluate them in roughly the same amount of time. It looks
> to me that the query optimizer does not realize the inner GROUP BY clause is
> unnecessary given the outer GROUP BY clause.
TBH, you are wasting your time reporting these sorts of things as bugs.
They are not bugs, unless equivalent queries give different answers.
At most, they represent optimizations nobody has bothered to put in.
In cases where the problem is really a visibly-badly-written query
(e.g., redundant GROUP BY clauses, as here), it's unclear that we'd
accept such an optimization if it were proposed, because adding checks
for such cases would necessarily penalize well-written queries to benefit
badly-written ones. The overhead would have to be extremely small, or
else the change would need to have some other benefit that accrues to
well-written queries as well as badly-written ones.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, liuxy@gatech.edu, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16888: Reoccurring group by clauses makes system slower
In-Reply-To: <3821998.1614093133@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox