Currently following query does not use an index: t-ishii@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers