aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/common/reloptions.c
diff options
context:
space:
mode:
authorItagaki Takahiro <itagaki.takahiro@gmail.com>2010-06-07 02:59:02 +0000
committerItagaki Takahiro <itagaki.takahiro@gmail.com>2010-06-07 02:59:02 +0000
commitb5faba1284c4e5108c6fbe577daa33f933e7a4e0 (patch)
tree86bb121d206f9369e8d744414c339826e1a54d83 /src/backend/access/common/reloptions.c
parent3fd839950a33a7d36ac83edf1f9cc6fb929d7649 (diff)
downloadpostgresql-b5faba1284c4e5108c6fbe577daa33f933e7a4e0.tar.gz
postgresql-b5faba1284c4e5108c6fbe577daa33f933e7a4e0.zip
Ensure default-only storage parameters for TOAST relations
to be initialized with proper values. Affected parameters are fillfactor, analyze_threshold, and analyze_scale_factor. Especially uninitialized fillfactor caused inefficient page usage because we built a StdRdOptions struct in which fillfactor is zero if any reloption is set for the toast table. In addition, we disallow toast.autovacuum_analyze_threshold and toast.autovacuum_analyze_scale_factor because we didn't actually support them; they are always ignored. Report by Rumko on pgsql-bugs on 12 May 2010. Analysis by Tom Lane and Alvaro Herrera. Patch by me. Backpatch to 8.4.
Diffstat (limited to 'src/backend/access/common/reloptions.c')
-rw-r--r--src/backend/access/common/reloptions.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 2b099e806c9..cd4f59005a0 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.34 2010/03/11 21:47:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.35 2010/06/07 02:59:02 itagaki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,7 +116,7 @@ static relopt_int intRelOpts[] =
{
"autovacuum_analyze_threshold",
"Minimum number of tuple inserts, updates or deletes prior to analyze",
- RELOPT_KIND_HEAP | RELOPT_KIND_TOAST
+ RELOPT_KIND_HEAP
},
-1, 0, INT_MAX
},
@@ -177,7 +177,7 @@ static relopt_real realRelOpts[] =
{
"autovacuum_analyze_scale_factor",
"Number of tuple inserts, updates or deletes prior to analyze as a fraction of reltuples",
- RELOPT_KIND_HEAP | RELOPT_KIND_TOAST
+ RELOPT_KIND_HEAP
},
-1, 0.0, 100.0
},
@@ -1156,10 +1156,21 @@ default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
bytea *
heap_reloptions(char relkind, Datum reloptions, bool validate)
{
+ StdRdOptions *rdopts;
+
switch (relkind)
{
case RELKIND_TOASTVALUE:
- return default_reloptions(reloptions, validate, RELOPT_KIND_TOAST);
+ rdopts = (StdRdOptions *)
+ default_reloptions(reloptions, validate, RELOPT_KIND_TOAST);
+ if (rdopts != NULL)
+ {
+ /* adjust default-only parameters for TOAST relations */
+ rdopts->fillfactor = 100;
+ rdopts->autovacuum.analyze_threshold = -1;
+ rdopts->autovacuum.analyze_scale_factor = -1;
+ }
+ return (bytea *) rdopts;
case RELKIND_RELATION:
return default_reloptions(reloptions, validate, RELOPT_KIND_HEAP);
default: