More optimization effort?

From: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: More optimization effort?
Date: 2017-07-20 23:11:07
Message-ID: 20170721.081107.2259073989173912397.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Currently following query does not use an index:

t-ishii(at)localhost: psql -p 5433 test
Pager usage is off.
psql (9.6.3)
Type "help" for help.

test=# explain select * from pgbench_accounts where aid*100 < 10000;
QUERY PLAN
------------------------------------------------------------------------
Seq Scan on pgbench_accounts (cost=0.00..3319.00 rows=33333 width=97)
Filter: ((aid * 100) < 10000)
(2 rows)

While following one does use the index.

test=# explain select * from pgbench_accounts where aid < 10000/100;
QUERY PLAN
--------------------------------------------------------------------------------------------------
Index Scan using pgbench_accounts_pkey on pgbench_accounts (cost=0.29..11.08 rows=102 width=97)
Index Cond: (aid < 100)
(2 rows)

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

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-07-21 00:42:45 Re: [PATCH] A hook for session start
Previous Message Josh Berkus 2017-07-20 23:09:14 Better error message for trying to drop a DB with open subscriptions?