Skip to content

Commit 3f76f65

Browse files
committed
doc: rewrite random_page_cost description
This removes some of the specifics of how the default was set, and adds a mention of latency as a reason the value is lower than the storage hardware might suggest. It still mentions caching. Discussion: https://postgr.es/m/CAKAnmmK_nSPYr53LobUwQD59a-8U9GEC3XGJ43oaTYJq5nAOkw@mail.gmail.com Backpatch-through: 13
1 parent a027ce3 commit 3f76f65

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

doc/src/sgml/config.sgml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5424,24 +5424,24 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
54245424
</para>
54255425

54265426
<para>
5427-
Random access to mechanical disk storage is normally much more expensive
5428-
than four times sequential access. However, a lower default is used
5429-
(4.0) because the majority of random accesses to disk, such as indexed
5430-
reads, are assumed to be in cache. The default value can be thought of
5431-
as modeling random access as 40 times slower than sequential, while
5432-
expecting 90% of random reads to be cached.
5433-
</para>
5434-
5435-
<para>
5436-
If you believe a 90% cache rate is an incorrect assumption
5437-
for your workload, you can increase random_page_cost to better
5438-
reflect the true cost of random storage reads. Correspondingly,
5439-
if your data is likely to be completely in cache, such as when
5440-
the database is smaller than the total server memory, decreasing
5441-
random_page_cost can be appropriate. Storage that has a low random
5442-
read cost relative to sequential, e.g., solid-state drives, might
5443-
also be better modeled with a lower value for random_page_cost,
5444-
e.g., <literal>1.1</literal>.
5427+
Random access to durable storage is normally much more expensive
5428+
than four times sequential access. However, a lower default is
5429+
used (4.0) because the majority of random accesses to storage,
5430+
such as indexed reads, are assumed to be in cache. Also, the
5431+
latency of network-attached storage tends to reduce the relative
5432+
overhead of random access.
5433+
</para>
5434+
5435+
<para>
5436+
If you believe caching is less frequent than the default
5437+
value reflects, and network latency is minimal, you can increase
5438+
random_page_cost to better reflect the true cost of random storage
5439+
reads. Storage that has a higher random read cost relative to
5440+
sequential, like magnetic disks, might also be better modeled with
5441+
a higher value for random_page_cost. Correspondingly, if your data
5442+
is likely to be completely in cache, such as when the database
5443+
is smaller than the total server memory, or network latency is
5444+
high, decreasing random_page_cost might be appropriate.
54455445
</para>
54465446

54475447
<tip>

0 commit comments

Comments
 (0)