From 50f4800e3501a84c0d41a5e29cf384bf465f230d Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Mon, 30 Sep 2024 09:52:28 -0400 Subject: [PATCH] Lower random_page_cost default to 1.2 and update docs about it. --- doc/src/sgml/config.sgml | 35 ++++++------------- src/backend/utils/misc/postgresql.conf.sample | 2 +- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 0aec11f443..e901a71613 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -5728,14 +5728,15 @@ ANY num_sync ( ). - + non-sequentially-fetched disk page. The default is 1.2. + Note that this value assumes use of a solid-state drive, which + has a low random read cost relative to sequential scans. If you + are a using a hard disk drive, raising the value to 3 + or 4 may give you better performance. + - Reducing this value relative to seq_page_cost + Reducing random_page_cost relative to seq_page_cost will cause the system to prefer index scans; raising it will make index scans look relatively more expensive. You can raise or lower both values together to change the importance of disk I/O @@ -5744,24 +5745,10 @@ ANY num_sync ( ). It can also be set + per-database and per-role, as needed. diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 667e0dc40a..424df4a868 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -417,7 +417,7 @@ # - Planner Cost Constants - #seq_page_cost = 1.0 # measured on an arbitrary scale -#random_page_cost = 4.0 # same scale as above +#random_page_cost = 1.2 # same scale as above #cpu_tuple_cost = 0.01 # same scale as above #cpu_index_tuple_cost = 0.005 # same scale as above #cpu_operator_cost = 0.0025 # same scale as above -- 2.30.2