Re: Should we update the random_page_cost default value? - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Should we update the random_page_cost default value?
Date
Msg-id dxv6irplpg7zcmo7325bijzhlycjtsw54h6bmz3p22kdl3ouip@jvn3exg6icie
Whole thread Raw
In response to Re: Should we update the random_page_cost default value?  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Should we update the random_page_cost default value?
List pgsql-hackers
Hi,

On 2025-10-06 12:57:20 -0400, Bruce Momjian wrote:
> On Mon, Oct  6, 2025 at 11:14:13AM -0400, Andres Freund wrote:
> > > It obviously contradicts the advice to set the value closer to 1.0. But
> > > why is that? SSDs are certainly better with random I/0, even if the I/O
> > > is not concurrent and the SSD is not fully utilized. So the 4.0 seems
> > > off, the value should be higher than what we got for SSDs ...
> > 
> > I'd guess that the *vast* majority of PG workloads these days run on networked
> > block storage. For those typically the actual latency at the storage level is
> > a rather small fraction of the overall IO latency, which is instead dominated
> > by network and other related cost (like the indirection to which storage
> > system to go to and crossing VM/host boundaries).  Because the majority of the
> > IO latency is not affected by the storage latency, but by network lotency, the
> > random IO/non-random IO difference will play less of a role.
> 
> Yes, the last time we discussed changing the default random page cost,
> September 2024, the argument was that while SSDs should be < 4, cloud
> storage might be > 4, so 4 was still a good value:
> 
>     https://www.postgresql.org/message-id/flat/877caxaxt6.fsf%40wibble.ilmari.org#8a10b7b8cf05410291d076f8def58c29

I think it's exactly the other way round. The difference between random and
sequential IO is *smaller* on cloud storage than on local storage, due to
network IO being the biggest component of IO latency on cloud storage - and
network latency is the same for random and sequential IO.


> Add in cache effects for all of these storage devices as outlined in our
> docs.

As discussed in [1], the cache effect related comments in the docs seem pretty
bogus. We'd be much better off just removing them, they really don't make much
sense.

Greetings,

Andres Freund


[1] https://www.postgresql.org/message-id/1156772.1730397196%40sss.pgh.pa.us



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Should we update the random_page_cost default value?
Next
From: Bruce Momjian
Date:
Subject: Re: Should we update the random_page_cost default value?