pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: XINYULIU@UMICH.EDU
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16624: Query Optimizer - Performance bug related to predicate simplification
Date: Fri, 18 Sep 2020 17:22:30 -0400
Message-ID: <544018.1600464150@sss.pgh.pa.us> (raw)
In-Reply-To: <16624-1375434d97659203@postgresql.org>
References: <16624-1375434d97659203@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> We are developing a tool for automatically finding performance bugs in
> PostgreSQL. Our key insight is that given a pair of semantic equivalent
> queries, a robust DBMS should return the same result within a similar
> execution time. Significant time difference suggests a potential performance
> bug in the DBMS.

Unfortunately, that's a viewpoint that is not going to win you a lot of
converts.

> First query:
> SELECT "ps_suppkey" 
> FROM   "partsupp" 
> WHERE  "ps_partkey" = 1486; 

> Second query:
> SELECT "ps_suppkey" 
> FROM   "partsupp" 
> WHERE  "ps_partkey" + 1486 = 2972; 

Sure, in theory the optimizer could rearrange that to
"WHERE ps_partkey = 2972 - 1486" and thus still have an indexable
condition.  In practice, we have essentially no interest in doing so.
It would require vastly more semantic knowledge than the optimizer
has got, and looking for such cases would consume lots of planner
cycles that would be better spent elsewhere.

If you want to complain that that makes Postgres' optimizer "not
robust", you're entitled to that opinion.  But it's very unlikely
to change in the foreseeable future.  We expect that if a user
cares about the performance of a particular query, they'll be
willing to write it in a form that the optimizer can deal with.

			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <544018.1600464150@sss.pgh.pa.us>
Permalink:  ../544018.1600464150@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/544018.1600464150@sss.pgh.pa.us

 · 

reply

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, XINYULIU@UMICH.EDU, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16624: Query Optimizer - Performance bug related to predicate simplification
  In-Reply-To: <544018.1600464150@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