If we access a 1 block table using a SeqScan then it costs
seq_page_cost, or 1 by default.

If we access the same 1 block table using an IndexScan then the access
costs random_page_cost to access the index block and then
random_page_cost to access to the data block.

So the same block accessed for different reasons is judged to have two
different costs. But that clearly must be wrong, since the I/O is a 1
block I/O in either case,

This leads to favouring seq scans in cases where the actual index scan
timing is actually less than seq scan.

Proposal: Make the first block of a seq scan cost random_page_cost, then
after that every additional block costs seq_page_cost.

-- 
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Support


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to