Skip to content

Commit d4e4cec

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 fca4f5f commit d4e4cec

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
@@ -5559,24 +5559,24 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
55595559
</para>
55605560

55615561
<para>
5562-
Random access to mechanical disk storage is normally much more expensive
5563-
than four times sequential access. However, a lower default is used
5564-
(4.0) because the majority of random accesses to disk, such as indexed
5565-
reads, are assumed to be in cache. The default value can be thought of
5566-
as modeling random access as 40 times slower than sequential, while
5567-
expecting 90% of random reads to be cached.
5568-
</para>
5569-
5570-
<para>
5571-
If you believe a 90% cache rate is an incorrect assumption
5572-
for your workload, you can increase random_page_cost to better
5573-
reflect the true cost of random storage reads. Correspondingly,
5574-
if your data is likely to be completely in cache, such as when
5575-
the database is smaller than the total server memory, decreasing
5576-
random_page_cost can be appropriate. Storage that has a low random
5577-
read cost relative to sequential, e.g., solid-state drives, might
5578-
also be better modeled with a lower value for random_page_cost,
5579-
e.g., <literal>1.1</literal>.
5562+
Random access to durable storage is normally much more expensive
5563+
than four times sequential access. However, a lower default is
5564+
used (4.0) because the majority of random accesses to storage,
5565+
such as indexed reads, are assumed to be in cache. Also, the
5566+
latency of network-attached storage tends to reduce the relative
5567+
overhead of random access.
5568+
</para>
5569+
5570+
<para>
5571+
If you believe caching is less frequent than the default
5572+
value reflects, and network latency is minimal, you can increase
5573+
random_page_cost to better reflect the true cost of random storage
5574+
reads. Storage that has a higher random read cost relative to
5575+
sequential, like magnetic disks, might also be better modeled with
5576+
a higher value for random_page_cost. Correspondingly, if your data
5577+
is likely to be completely in cache, such as when the database
5578+
is smaller than the total server memory, or network latency is
5579+
high, decreasing random_page_cost might be appropriate.
55805580
</para>
55815581

55825582
<tip>

0 commit comments

Comments
 (0)