pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: XINYULIU@umich.edu, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #16624: Query Optimizer - Performance bug related to predicate simplification
Date: Wed, 23 Sep 2020 15:48:03 -0400
Message-ID: <1505476.1600890483@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH2-WznKMCs=g13dqo-8GgMdD5ik6HZ798B41_mnNnRMzFWLwA@mail.gmail.com>
References: <16624-1375434d97659203@postgresql.org>
	<544018.1600464150@sss.pgh.pa.us>
	<CAH2-WznKMCs=g13dqo-8GgMdD5ik6HZ798B41_mnNnRMzFWLwA@mail.gmail.com>

Peter Geoghegan <pg@bowt.ie> writes:
> Evidently nobody even tries to do this stuff.

Yeah.  But it would be particularly hard to do in Postgres, because of
our resolutely extensible approach to data types and operators/functions.
We'd have to devise some general-purpose APIs whereby a specific data
type or function could decide whether a given transformation is valid
or safe.  It's not even very clear where would be the right place to
lodge the knowledge.

If you were really intent on making this happen, you could imagine
for instance attaching a SupportRequestSimplify hook to "int4eq",
which could transform "x - c1 = c2" into "x = c1 + c2" after verifying
that the constant values wouldn't produce overflow.  But this idea
doesn't scale very well, since you'd really be talking about looking
for a whole bunch of different possible rearrangements not just one.
And it's unclear how you could avoid reimplementing a bunch of that
logic for each different equality operator.  On top of that, you would
have little visibility into whether this was worth the cycles, since
such code would be unlikely to know whether "x" is an indexable
value or whether the expression occurs in a place where it could
be used in an indexqual anyway.

			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <1505476.1600890483@sss.pgh.pa.us>
Permalink:  ../1505476.1600890483@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1505476.1600890483@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, pg@bowt.ie, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16624: Query Optimizer - Performance bug related to predicate simplification
  In-Reply-To: <1505476.1600890483@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