Index-only scan and random_page_cost

From: Konstantin Knizhnik <knizhnik(at)garret(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Index-only scan and random_page_cost
Date: 2023-02-03 17:55:37
Message-ID: 97128c23-dca1-68ae-1961-e15e9acbdc81@garret.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Right now cost of index-only scan is using `random_page_cost`.
Certainly for point selects we really have random access pattern, but
queries like "select count(*) from hits"  access pattern is more or less
sequential:
we are iterating through subsequent leaf B-Tree pages.  As far as
default value of `random_page_cost`  is 4 times larger than `seq_page_cost`
it may force Postgres optimizer to choose sequential scan, while
index-only scan is usually much faster in this case.
Can we do something here to provide more accurate cost estimation?

Browse pgsql-hackers by date

  From Date Subject
Next Message Nitin Jadhav 2023-02-03 18:48:04 Re: Fix GUC_NO_SHOW_ALL test scenario in 003_check_guc.pl
Previous Message Tom Lane 2023-02-03 17:52:50 Re: run pgindent on a regular basis / scripted manner