Re: More optimization effort?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: More optimization effort?
Date: 2017-07-21 14:33:03
Message-ID: 30386.1500647583@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> writes:
> Currently following query does not use an index:
> test=# explain select * from pgbench_accounts where aid*100 < 10000;
> While following one does use the index.
> test=# explain select * from pgbench_accounts where aid < 10000/100;

> Is it worth to make our optimizer a little bit smarter to convert the
> the first query into the second form?

That's a rather ambitious definition of "little bit" smarter.

For starters, I'm not sure those queries are even fully equivalent
w.r.t. issues like overflow and roundoff. While a person might
decide that the transformation is OK anyway, I'm not sure that the
optimizer should be allowed to take such liberties.

But the bigger picture is that doing something that helps to any
useful extent would require a really substantial amount of new,
datatype- and operator-specific knowledge that doesn't exist in the
system today. And as Craig noted, applying that knowledge would
be expensive, even in cases where it failed to help.

So, color me skeptical ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marina Polyakova 2017-07-21 14:39:00 Re: WIP Patch: Precalculate stable functions, infrastructure v1
Previous Message Hadi Moshayedi 2017-07-21 14:32:11 Re: [PATCH] Make ExplainBeginGroup()/ExplainEndGroup() public.