Re: [HACKERS] More optimization effort? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] More optimization effort?
Date
Msg-id 30386.1500647583@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] More optimization effort?  (Tatsuo Ishii <ishii@sraoss.co.jp>)
Responses Re: [HACKERS] More optimization effort?
List pgsql-hackers
Tatsuo Ishii <ishii@sraoss.co.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



pgsql-hackers by date:

Previous
From: Hadi Moshayedi
Date:
Subject: Re: [HACKERS] [PATCH] Make ExplainBeginGroup()/ExplainEndGroup() public.
Next
From: Marina Polyakova
Date:
Subject: Re: [HACKERS] WIP Patch: Precalculate stable functions,infrastructure v1