SeqScan costs - Mailing list pgsql-hackers

From Simon Riggs
Subject SeqScan costs
Date
Msg-id 1218565866.5343.118.camel@ebony.2ndQuadrant
Whole thread Raw
Responses Re: SeqScan costs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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.comPostgreSQL Training, Services and Support



pgsql-hackers by date:

Previous
From: "Robert Haas"
Date:
Subject: Re: Plugin system like Firefox
Next
From: Markus Wanner
Date:
Subject: Re: Plugin system like Firefox