Instead of having a configure-time DEFAULT_ATTSTATTARGET, store -1 in
authorTom Lane
Wed, 31 Jul 2002 17:19:54 +0000 (17:19 +0000)
committerTom Lane
Wed, 31 Jul 2002 17:19:54 +0000 (17:19 +0000)
attstattarget to indicate 'use the default'.  The default is now a GUC
variable default_statistics_target, and so may be changed on the fly.  Along
the way we gain the ability to have pg_dump dump the per-column statistics
target when it's not the default.  Patch by Neil Conway, with some kibitzing
from Tom Lane.

18 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/ref/alter_table.sgml
doc/src/sgml/ref/analyze.sgml
doc/src/sgml/runtime.sgml
src/backend/access/common/tupdesc.c
src/backend/catalog/genbki.sh
src/backend/catalog/heap.c
src/backend/commands/analyze.c
src/backend/commands/tablecmds.c
src/backend/parser/gram.y
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/psql/tab-complete.c
src/include/catalog/pg_attribute.h
src/include/commands/vacuum.h
src/include/pg_config.h.in

index 13f883a65de7bec4b3790fcc93b5abcebb039e07..8bf4bf816f0ef6ad5dcee0fa6aab964f16a723af 100644 (file)
@@ -1,6 +1,6 @@
 
 
 
        of statistics accumulated for this column by
        ANALYZE.
        A zero value indicates that no statistics should be collected.
-       The exact meaning of positive values is data type-dependent.
-       For scalar data types, attstattarget
+       A negative value says to use the system default statistics target.
+       The exact meaning of positive values is datatype-dependent.
+       For scalar datatypes, attstattarget
        is both the target number of most common values
        to collect, and the target number of histogram bins to create.
       
index 9acd474203cce3384b25972de8bbdebfabe0b796..11da9fdf60c1c952006c86053e8900e7e6e874c0 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -218,6 +218,8 @@ ALTER TABLE table
       This form
       sets the per-column statistics-gathering target for subsequent
        operations.
+      The target can be set in the range 0 to 1000; alternatively, set it
+      to -1 to revert to using the system default statistics target.
      
     
    
index 5fbef560decb8e21d3da2ab724c5a3bfe6fb3a2f..72dc5cdcdebe79d254ec181a43cf807c0850be80 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -157,7 +157,9 @@ ANALYZE [ VERBOSE ] [ table [ (
   
 
   
-   The extent of analysis can be controlled by adjusting the per-column
+   The extent of analysis can be controlled by adjusting the
+   default_statistics_target parameter variable, or on a
+   column-by-column basis by setting the per-column
    statistics target with ALTER TABLE ALTER COLUMN SET
    STATISTICS (see
    ).  The
@@ -165,8 +167,8 @@ ANALYZE [ VERBOSE ] [ table [ (
    list and the maximum number of bins in the histogram.  The default
    target value is 10, but this can be adjusted up or down to trade off
    accuracy of planner estimates against the time taken for
-   ANALYZE and the
-   amount of space occupied in pg_statistic.
+   ANALYZE and the amount of space occupied
+   in pg_statistic.
    In particular, setting the statistics target to zero disables collection of
    statistics for that column.  It may be useful to do that for columns that
    are never used as part of the WHERE, GROUP BY, or ORDER BY clauses of
index 15f2e6e56af4105a2ca2f51fe01c2fd4e040e99c..8733725c2e32af444df5d3c9278d3b8995e71bd1 100644 (file)
@@ -1,5 +1,5 @@
 
 
 
@@ -592,6 +592,19 @@ env PGOPTIONS='-c geqo=off' psql
       
      
     
+     
+      DEFAULT_STATISTICS_TARGET (integer)
+      
+       
+        Sets the default statistics target for table columns that have not
+   had a column-specific target set via ALTER TABLE SET
+   STATISTICS.  Larger values increase the time needed to do
+   ANALYZE, but may improve the quality of the planner's
+   estimates.
+       
+      
+     
+    
      
       EFFECTIVE_CACHE_SIZE (floating point)
       
index 24f33fac4beec8b30b08a5193cc6ffbb1d7ce3bb..1eb62dea91a0d5529dfa59ef8165b90f31a96fb4 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.81 2002/07/20 05:16:56 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.82 2002/07/31 17:19:51 tgl Exp $
  *
  * NOTES
  *   some of the executor utility code such as "ExecTypeFromTL" should be
@@ -375,7 +375,7 @@ TupleDescInitEntry(TupleDesc desc,
    else
        MemSet(NameStr(att->attname), 0, NAMEDATALEN);
 
-   att->attstattarget = 0;
+   att->attstattarget = -1;
    att->attcacheoff = -1;
    att->atttypmod = typmod;
 
index 94db1c65189ec6bac0068ee6fc34d8979037c7ed..2fbb84494ca4a0eb523f7cb7634e6ab4329d84ab 100644 (file)
@@ -10,7 +10,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.27 2002/04/27 21:24:33 tgl Exp $
+#    $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.28 2002/07/31 17:19:51 tgl Exp $
 #
 # NOTES
 #    non-essential whitespace is removed from the generated file.
@@ -126,12 +126,11 @@ for dir in $INCLUDE_DIRS; do
     fi
 done
 
-# Get INDEX_MAX_KEYS and DEFAULT_ATTSTATTARGET from pg_config.h
+# Get INDEX_MAX_KEYS from pg_config.h
 # (who needs consistency?)
 for dir in $INCLUDE_DIRS; do
     if [ -f "$dir/pg_config.h" ]; then
         INDEXMAXKEYS=`grep '^#define[  ]*INDEX_MAX_KEYS' $dir/pg_config.h | $AWK '{ print $3 }'`
-        DEFAULTATTSTATTARGET=`grep '^#define[  ]*DEFAULT_ATTSTATTARGET' $dir/pg_config.h | $AWK '{ print $3 }'`
         break
     fi
 done
@@ -194,7 +193,6 @@ sed -e "s/;[    ]*$//g" \
     -e "s/PGUID/1/g" \
     -e "s/NAMEDATALEN/$NAMEDATALEN/g" \
     -e "s/PGNSP/$PG_CATALOG_NAMESPACE/g" \
-    -e "s/DEFAULT_ATTSTATTARGET/$DEFAULTATTSTATTARGET/g" \
     -e "s/INDEX_MAX_KEYS\*2/$INDEXMAXKEYS2/g" \
     -e "s/INDEX_MAX_KEYS\*4/$INDEXMAXKEYS4/g" \
     -e "s/INDEX_MAX_KEYS/$INDEXMAXKEYS/g" \
index 07373663aebf8c0d145c321f86d451cb3dbc708e..6045c17bb6a16c54d063b1eb33399c0bacb88d16 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.213 2002/07/24 19:11:07 petere Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.214 2002/07/31 17:19:51 tgl Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -441,7 +441,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
        /* Fill in the correct relation OID */
        (*dpp)->attrelid = new_rel_oid;
        /* Make sure these are OK, too */
-       (*dpp)->attstattarget = DEFAULT_ATTSTATTARGET;
+       (*dpp)->attstattarget = -1;
        (*dpp)->attcacheoff = -1;
 
        tup = heap_addheader(Natts_pg_attribute,
index 6caa968b5d20dcd664b44b7f6efca6e9272cd773..55069aa6feb8b30512e33e44bd17527b9ef46bee 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.38 2002/06/20 20:29:26 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.39 2002/07/31 17:19:51 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -107,6 +107,11 @@ typedef struct
 #define swapInt(a,b)   do {int _tmp; _tmp=a; a=b; b=_tmp;} while(0)
 #define swapDatum(a,b) do {Datum _tmp; _tmp=a; a=b; b=_tmp;} while(0)
 
+
+/* Default statistics target (GUC parameter) */
+int        default_statistics_target = 10;
+
+
 static int elevel = -1;
 
 static MemoryContext anl_context = NULL;
@@ -384,7 +389,7 @@ examine_attribute(Relation onerel, int attnum)
    VacAttrStats *stats;
 
    /* Don't analyze column if user has specified not to */
-   if (attr->attstattarget <= 0)
+   if (attr->attstattarget == 0)
        return NULL;
 
    /* If column has no "=" operator, we can't do much of anything */
@@ -425,6 +430,10 @@ examine_attribute(Relation onerel, int attnum)
    stats->eqopr = eqopr;
    stats->eqfunc = eqfunc;
 
+   /* If the attstattarget column is negative, use the default value */
+   if (stats->attr->attstattarget < 0)
+       stats->attr->attstattarget = default_statistics_target;
+
    /* Is there a "<" operator with suitable semantics? */
    func_operator = compatible_oper(makeList1(makeString("<")),
                                    attr->atttypid,
@@ -466,14 +475,14 @@ examine_attribute(Relation onerel, int attnum)
         * know it at this point.
         *--------------------
         */
-       stats->minrows = 300 * attr->attstattarget;
+       stats->minrows = 300 * stats->attr->attstattarget;
    }
    else
    {
        /* Can't do much but the minimal stuff */
        stats->algcode = ALG_MINIMAL;
        /* Might as well use the same minrows as above */
-       stats->minrows = 300 * attr->attstattarget;
+       stats->minrows = 300 * stats->attr->attstattarget;
    }
 
    return stats;
index 6b943723bb838a19c6143a8b013b32ad85f54b19..cfcf5d5ddfd27f0675b0207c353947bc15926064 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.24 2002/07/20 05:16:57 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.25 2002/07/31 17:19:51 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1668,7 +1668,7 @@ AlterTableAddColumn(Oid myrelid,
    attribute->attrelid = myrelid;
    namestrcpy(&(attribute->attname), colDef->colname);
    attribute->atttypid = HeapTupleGetOid(typeTuple);
-   attribute->attstattarget = DEFAULT_ATTSTATTARGET;
+   attribute->attstattarget = -1;
    attribute->attlen = tform->typlen;
    attribute->attcacheoff = -1;
    attribute->atttypmod = colDef->typename->typmod;
@@ -2184,12 +2184,18 @@ AlterTableAlterColumnFlags(Oid myrelid,
        newtarget = intVal(flagValue);
 
        /*
-        * Limit target to sane range (should we raise an error instead?)
+        * Limit target to a sane range
         */
-       if (newtarget < 0)
-           newtarget = 0;
+       if (newtarget < -1)
+       {
+           elog(ERROR, "ALTER TABLE: statistics target %d is too low",
+                newtarget);
+       }
        else if (newtarget > 1000)
+       {
+           elog(WARNING, "ALTER TABLE: lowering statistics target to 1000");
            newtarget = 1000;
+       }
    }
    else if (*flagType == 'M')
    {
index 685919a3ff532aabf577b45c170b79bdf8c5412d..73c2875d1b7e98b187bd056331b1e3f0cdba0090 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.351 2002/07/30 16:55:44 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.352 2002/07/31 17:19:51 tgl Exp $
  *
  * HISTORY
  *   AUTHOR            DATE            MAJOR EVENT
@@ -1134,14 +1134,14 @@ AlterTableStmt:
                    n->name = $6;
                    $$ = (Node *)n;
                }
-           /* ALTER TABLE  ALTER [COLUMN]  SET STATISTICS const> */
-           | ALTER TABLE relation_expr ALTER opt_column ColId SET STATISTICS Iconst
+           /* ALTER TABLE  ALTER [COLUMN]  SET STATISTICS ntegerOnly> */
+           | ALTER TABLE relation_expr ALTER opt_column ColId SET STATISTICS IntegerOnly
                {
                    AlterTableStmt *n = makeNode(AlterTableStmt);
                    n->subtype = 'S';
                    n->relation = $3;
                    n->name = $6;
-                   n->def = (Node *) makeInteger($9);
+                   n->def = (Node *) $9;
                    $$ = (Node *)n;
                }
            /* ALTER TABLE  ALTER [COLUMN]  SET STORAGE  */
index 4a03c95277b6d356f484de5098a461a1ce09de6d..dd22003bac7c3141c247f645e70c9a64945992f6 100644 (file)
@@ -5,7 +5,7 @@
  * command, configuration file, and command line options.
  * See src/backend/utils/misc/README for more information.
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.76 2002/07/30 16:20:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.77 2002/07/31 17:19:52 tgl Exp $
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  * Written by Peter Eisentraut .
@@ -26,6 +26,7 @@
 #include "catalog/pg_type.h"
 #include "commands/async.h"
 #include "commands/variable.h"
+#include "commands/vacuum.h"
 #include "executor/executor.h"
 #include "fmgr.h"
 #include "libpq/auth.h"
@@ -491,6 +492,10 @@ static struct config_bool
 static struct config_int
            ConfigureNamesInt[] =
 {
+   {
+       { "default_statistics_target", PGC_USERSET }, &default_statistics_target,
+       10, 1, 1000, NULL, NULL
+   },
    {
        { "geqo_threshold", PGC_USERSET }, &geqo_rels,
        DEFAULT_GEQO_RELS, 2, INT_MAX, NULL, NULL
index 1830ab166c0f70b605eab16d19331d8335421bb0..be097186caccf949bd46251a05516e4cf4e06066 100644 (file)
@@ -95,6 +95,7 @@
 #cpu_index_tuple_cost = 0.001
 #cpu_operator_cost = 0.0025
 
+#default_statistics_target = 10    # range 1-1000
 
 #
 #  GEQO Optimizer Parameters
index 76623f61835ba76cdba29982656802d8b115572c..7ca027e010516ccd51e6888cff3aeb309e111f3d 100644 (file)
@@ -22,7 +22,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.277 2002/07/30 21:56:04 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.278 2002/07/31 17:19:52 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -2344,6 +2344,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
    int         i_attname;
    int         i_atttypname;
    int         i_atttypmod;
+   int         i_attstattarget;
    int         i_attnotnull;
    int         i_atthasdef;
    PGresult   *res;
@@ -2384,7 +2385,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
 
        if (g_fout->remoteVersion >= 70300)
        {
-           appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, "
+           appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, attstattarget, "
                              "attnotnull, atthasdef, "
                              "pg_catalog.format_type(atttypid,atttypmod) as atttypname "
                              "from pg_catalog.pg_attribute a "
@@ -2395,7 +2396,12 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
        }
        else if (g_fout->remoteVersion >= 70100)
        {
-           appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, "
+           /*
+            * attstattarget doesn't exist in 7.1.  It does exist in 7.2,
+            * but we don't dump it because we can't tell whether it's been
+            * explicitly set or was just a default.
+            */
+           appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, -1 as attstattarget, "
                              "attnotnull, atthasdef, "
                              "format_type(atttypid,atttypmod) as atttypname "
                              "from pg_attribute a "
@@ -2407,7 +2413,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
        else
        {
            /* format_type not available before 7.1 */
-           appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, "
+           appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, -1 as attstattarget, "
                              "attnotnull, atthasdef, "
                              "(select typname from pg_type where oid = atttypid) as atttypname "
                              "from pg_attribute a "
@@ -2430,6 +2436,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
        i_attname = PQfnumber(res, "attname");
        i_atttypname = PQfnumber(res, "atttypname");
        i_atttypmod = PQfnumber(res, "atttypmod");
+       i_attstattarget = PQfnumber(res, "attstattarget");
        i_attnotnull = PQfnumber(res, "attnotnull");
        i_atthasdef = PQfnumber(res, "atthasdef");
 
@@ -2437,6 +2444,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
        tblinfo[i].attnames = (char **) malloc(ntups * sizeof(char *));
        tblinfo[i].atttypnames = (char **) malloc(ntups * sizeof(char *));
        tblinfo[i].atttypmod = (int *) malloc(ntups * sizeof(int));
+       tblinfo[i].attstattarget = (int *) malloc(ntups * sizeof(int));
        tblinfo[i].notnull = (bool *) malloc(ntups * sizeof(bool));
        tblinfo[i].adef_expr = (char **) malloc(ntups * sizeof(char *));
        tblinfo[i].inhAttrs = (bool *) malloc(ntups * sizeof(bool));
@@ -2449,6 +2457,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
            tblinfo[i].attnames[j] = strdup(PQgetvalue(res, j, i_attname));
            tblinfo[i].atttypnames[j] = strdup(PQgetvalue(res, j, i_atttypname));
            tblinfo[i].atttypmod[j] = atoi(PQgetvalue(res, j, i_atttypmod));
+           tblinfo[i].attstattarget[j] = atoi(PQgetvalue(res, j, i_attstattarget));
            tblinfo[i].notnull[j] = (PQgetvalue(res, j, i_attnotnull)[0] == 't');
            tblinfo[i].adef_expr[j] = NULL; /* fix below */
            if (PQgetvalue(res, j, i_atthasdef)[0] == 't')
@@ -5144,6 +5153,24 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
            appendPQExpBuffer(q, " WITHOUT OIDS");
 
        appendPQExpBuffer(q, ";\n");
+
+       /*
+        * Dump per-column statistics information. We only issue an ALTER TABLE
+        * statement if the attstattarget entry for this column is non-negative
+        * (i.e. it's not the default value)
+        */
+       for (j = 0; j  < tbinfo->numatts; j++)
+       {
+           if (tbinfo->attstattarget[j] >= 0)
+           {
+               appendPQExpBuffer(q, "ALTER TABLE %s ",
+                                 fmtId(tbinfo->relname, force_quotes));
+               appendPQExpBuffer(q, "ALTER COLUMN %s ",
+                                 fmtId(tbinfo->attnames[j], force_quotes));
+               appendPQExpBuffer(q, "SET STATISTICS %d;\n",
+                                 tbinfo->attstattarget[j]);
+           }
+       }
    }
 
    ArchiveEntry(fout, objoid, tbinfo->relname,
index b3b943dde08c4516543efc727797474a633f21c5..6a6322c9ca2fb1525fd56a6ea781614da505390d 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_dump.h,v 1.92 2002/07/30 21:56:04 tgl Exp $
+ * $Id: pg_dump.h,v 1.93 2002/07/31 17:19:53 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -122,6 +122,7 @@ typedef struct _tableInfo
    char      **attnames;       /* the attribute names */
    char      **atttypnames;    /* attribute type names */
    int        *atttypmod;      /* type-specific type modifiers */
+   int        *attstattarget;  /* attribute statistics targets */
    /*
     * Note: we need to store per-attribute notnull and default stuff for
     * all interesting tables so that we can tell which constraints were
index 8e37306f3800b9365f9ad5bae6f27ff4154d94e9..f60ccae324a45f10a4d0cab63fc825d7c227eb88 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.52 2002/07/30 16:35:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.53 2002/07/31 17:19:53 tgl Exp $
  */
 
 /*----------------------------------------------------------------------
@@ -246,6 +246,7 @@ psql_completion(char *text, int start, int end)
        "password_encryption",
        "transform_null_equals",
 
+       "default_statistics_target",
        "geqo_threshold",
        "geqo_pool_size",
        "geqo_effort",
index 462df4cc17ed150e59a5fb25335165957640ee88..15945192a00d052953fe52e540801710c8760ab8 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_attribute.h,v 1.94 2002/07/24 19:11:12 petere Exp $
+ * $Id: pg_attribute.h,v 1.95 2002/07/31 17:19:54 tgl Exp $
  *
  * NOTES
  *   the genbki.sh script reads this file and generates .bki
@@ -58,7 +58,8 @@ CATALOG(pg_attribute) BOOTSTRAP BKI_WITHOUT_OIDS
     * attstattarget is the target number of statistics datapoints to
     * collect during VACUUM ANALYZE of this column.  A zero here
     * indicates that we do not wish to collect any stats about this
-    * column.
+    * column. A "-1" here indicates that no value has been explicitly
+    * set for this column, so ANALYZE should use the default setting.
     */
    int4        attstattarget;
 
@@ -210,7 +211,7 @@ typedef FormData_pg_attribute *Form_pg_attribute;
  * ----------------
  */
 #define Schema_pg_type \
-{ 1247, {"typname"},      19, DEFAULT_ATTSTATTARGET, NAMEDATALEN,  1, 0, -1, -1, false, 'p', false, 'i', false, false }, \
+{ 1247, {"typname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', false, false }, \
 { 1247, {"typnamespace"},  26, 0,  4,  2, 0, -1, -1, true, 'p', false, 'i', false, false }, \
 { 1247, {"typowner"},     23, 0,   4,  3, 0, -1, -1, true, 'p', false, 'i', false, false }, \
 { 1247, {"typlen"},           21, 0,   2,  4, 0, -1, -1, true, 'p', false, 's', false, false }, \
@@ -232,7 +233,7 @@ typedef FormData_pg_attribute *Form_pg_attribute;
 { 1247, {"typdefault"},    25, 0,  -1, 20, 0, -1, -1, false, 'x', false, 'i', false, false }
 
 
-DATA(insert ( 1247 typname         19 DEFAULT_ATTSTATTARGET NAMEDATALEN   1 0 -1 -1 f p f i f f));
+DATA(insert ( 1247 typname         19 -1 NAMEDATALEN   1 0 -1 -1 f p f i f f));
 DATA(insert ( 1247 typnamespace        26 0  4   2 0 -1 -1 t p f i f f));
 DATA(insert ( 1247 typowner            23 0  4   3 0 -1 -1 t p f i f f));
 DATA(insert ( 1247 typlen          21 0  2   4 0 -1 -1 t p f s f f));
@@ -289,7 +290,7 @@ DATA(insert ( 1262 tableoid         26 0  4  -7 0 -1 -1 t p f i f f));
  * ----------------
  */
 #define Schema_pg_proc \
-{ 1255, {"proname"},           19, DEFAULT_ATTSTATTARGET, NAMEDATALEN,  1, 0, -1, -1, false, 'p', false, 'i', false, false }, \
+{ 1255, {"proname"},           19, -1, NAMEDATALEN,  1, 0, -1, -1, false, 'p', false, 'i', false, false }, \
 { 1255, {"pronamespace"},      26, 0,  4,  2, 0, -1, -1, true, 'p', false, 'i', false, false }, \
 { 1255, {"proowner"},          23, 0,  4,  3, 0, -1, -1, true, 'p', false, 'i', false, false }, \
 { 1255, {"prolang"},           26, 0,  4,  4, 0, -1, -1, true, 'p', false, 'i', false, false }, \
@@ -305,7 +306,7 @@ DATA(insert ( 1262 tableoid         26 0  4  -7 0 -1 -1 t p f i f f));
 { 1255, {"probin"},                17, 0, -1, 14, 0, -1, -1, false, 'x', false, 'i', false, false }, \
 { 1255, {"proacl"},              1034, 0, -1, 15, 0, -1, -1, false, 'x', false, 'i', false, false }
 
-DATA(insert ( 1255 proname         19 DEFAULT_ATTSTATTARGET NAMEDATALEN   1 0 -1 -1 f p f i f f));
+DATA(insert ( 1255 proname         19 -1 NAMEDATALEN   1 0 -1 -1 f p f i f f));
 DATA(insert ( 1255 pronamespace        26 0  4   2 0 -1 -1 t p f i f f));
 DATA(insert ( 1255 proowner            23 0  4   3 0 -1 -1 t p f i f f));
 DATA(insert ( 1255 prolang         26 0  4   4 0 -1 -1 t p f i f f));
@@ -332,8 +333,8 @@ DATA(insert ( 1255 tableoid         26 0  4  -7 0 -1 -1 t p f i f f));
  *     pg_shadow
  * ----------------
  */
-DATA(insert ( 1260 usename         19  DEFAULT_ATTSTATTARGET NAMEDATALEN   1 0 -1 -1 f p f i f f));
-DATA(insert ( 1260 usesysid            23  DEFAULT_ATTSTATTARGET   4   2 0 -1 -1 t p f i f f));
+DATA(insert ( 1260 usename         19  -1 NAMEDATALEN  1 0 -1 -1 f p f i f f));
+DATA(insert ( 1260 usesysid            23  -1  4   2 0 -1 -1 t p f i f f));
 DATA(insert ( 1260 usecreatedb     16  0   1   3 0 -1 -1 t p f c f f));
 DATA(insert ( 1260 usesuper            16  0   1   4 0 -1 -1 t p f c f f));
 DATA(insert ( 1260 usecatupd       16  0   1   5 0 -1 -1 t p f c f f));
@@ -352,8 +353,8 @@ DATA(insert ( 1260 tableoid         26 0  4  -7 0 -1 -1 t p f i f f));
  *     pg_group
  * ----------------
  */
-DATA(insert ( 1261 groname         19 DEFAULT_ATTSTATTARGET NAMEDATALEN  1 0 -1 -1 f p f i f f));
-DATA(insert ( 1261 grosysid            23 DEFAULT_ATTSTATTARGET  4   2 0 -1 -1 t p f i f f));
+DATA(insert ( 1261 groname         19 -1 NAMEDATALEN  1 0 -1 -1 f p f i f f));
+DATA(insert ( 1261 grosysid            23 -1  4   2 0 -1 -1 t p f i f f));
 DATA(insert ( 1261 grolist       1007 0 -1   3 0 -1 -1 f x f i f f));
 DATA(insert ( 1261 ctid                27 0  6  -1 0 -1 -1 f p f i f f));
 /* no OIDs in pg_group */
@@ -368,8 +369,8 @@ DATA(insert ( 1261 tableoid         26 0  4  -7 0 -1 -1 t p f i f f));
  * ----------------
  */
 #define Schema_pg_attribute \
-{ 1249, {"attrelid"},    26, DEFAULT_ATTSTATTARGET,    4,  1, 0, -1, -1, true, 'p', false, 'i', false, false }, \
-{ 1249, {"attname"},     19, DEFAULT_ATTSTATTARGET, NAMEDATALEN,   2, 0, -1, -1, false, 'p', false, 'i', false, false }, \
+{ 1249, {"attrelid"},    26, -1,   4,  1, 0, -1, -1, true, 'p', false, 'i', false, false }, \
+{ 1249, {"attname"},     19, -1, NAMEDATALEN,  2, 0, -1, -1, false, 'p', false, 'i', false, false }, \
 { 1249, {"atttypid"},    26, 0,    4,  3, 0, -1, -1, true, 'p', false, 'i', false, false }, \
 { 1249, {"attstattarget"}, 23, 0,  4,  4, 0, -1, -1, true, 'p', false, 'i', false, false }, \
 { 1249, {"attlen"},          21, 0,    2,  5, 0, -1, -1, true, 'p', false, 's', false, false }, \
@@ -384,8 +385,8 @@ DATA(insert ( 1261 tableoid         26 0  4  -7 0 -1 -1 t p f i f f));
 { 1249, {"attnotnull"},  16, 0, 1, 14, 0, -1, -1, true, 'p', false, 'c', false, false }, \
 { 1249, {"atthasdef"},  16, 0, 1, 15, 0, -1, -1, true, 'p', false, 'c', false, false }
 
-DATA(insert ( 1249 attrelid            26 DEFAULT_ATTSTATTARGET  4   1 0 -1 -1 t p f i f f));
-DATA(insert ( 1249 attname         19 DEFAULT_ATTSTATTARGET NAMEDATALEN  2 0 -1 -1 f p f i f f));
+DATA(insert ( 1249 attrelid            26 -1  4   1 0 -1 -1 t p f i f f));
+DATA(insert ( 1249 attname         19 -1 NAMEDATALEN  2 0 -1 -1 f p f i f f));
 DATA(insert ( 1249 atttypid            26 0  4   3 0 -1 -1 t p f i f f));
 DATA(insert ( 1249 attstattarget   23 0  4   4 0 -1 -1 t p f i f f));
 DATA(insert ( 1249 attlen          21 0  2   5 0 -1 -1 t p f s f f));
@@ -412,7 +413,7 @@ DATA(insert ( 1249 tableoid         26 0  4  -7 0 -1 -1 t p f i f f));
  * ----------------
  */
 #define Schema_pg_class \
-{ 1259, {"relname"},      19, DEFAULT_ATTSTATTARGET, NAMEDATALEN,  1, 0, -1, -1, false, 'p', false, 'i', false, false }, \
+{ 1259, {"relname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', false, false }, \
 { 1259, {"relnamespace"},  26, 0,  4,  2, 0, -1, -1, true, 'p', false, 'i', false, false }, \
 { 1259, {"reltype"},      26, 0,   4,  3, 0, -1, -1, true, 'p', false, 'i', false, false }, \
 { 1259, {"relowner"},     23, 0,   4,  4, 0, -1, -1, true, 'p', false, 'i', false, false }, \
@@ -437,7 +438,7 @@ DATA(insert ( 1249 tableoid         26 0  4  -7 0 -1 -1 t p f i f f));
 { 1259, {"relhassubclass"},16, 0,  1, 23, 0, -1, -1, true, 'p', false, 'c', false, false }, \
 { 1259, {"relacl"},         1034, 0,  -1, 24, 0, -1, -1, false, 'x', false, 'i', false, false }
 
-DATA(insert ( 1259 relname         19 DEFAULT_ATTSTATTARGET NAMEDATALEN   1 0 -1 -1 f p f i f f));
+DATA(insert ( 1259 relname         19 -1 NAMEDATALEN   1 0 -1 -1 f p f i f f));
 DATA(insert ( 1259 relnamespace        26 0  4   2 0 -1 -1 t p f i f f));
 DATA(insert ( 1259 reltype         26 0  4   3 0 -1 -1 t p f i f f));
 DATA(insert ( 1259 relowner            23 0  4   4 0 -1 -1 t p f i f f));
index 42986f4ed4d6a110590c80cd38234afbe8cb7940..9d6565659b855f84b8a529b58457bab1976e8d22 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: vacuum.h,v 1.44 2002/06/20 20:29:49 momjian Exp $
+ * $Id: vacuum.h,v 1.45 2002/07/31 17:19:54 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,6 +34,9 @@ typedef struct VacRUsage
    struct rusage ru;
 } VacRUsage;
 
+/* Default statistics target (GUC parameter) */
+extern int default_statistics_target;
+
 
 /* in commands/vacuum.c */
 extern void vacuum(VacuumStmt *vacstmt);
index 7a616440cf47f08b7e6386e6a6975a8b400bede3..01d5465ad84bb5baa81cf0cd3c7a1973631c6712 100644 (file)
@@ -8,7 +8,7 @@
  * or in pg_config.h afterwards.  Of course, if you edit pg_config.h, then your
  * changes will be overwritten the next time you run configure.
  *
- * $Id: pg_config.h.in,v 1.25 2002/07/20 05:16:59 momjian Exp $
+ * $Id: pg_config.h.in,v 1.26 2002/07/31 17:19:54 tgl Exp $
  */
 
 #ifndef PG_CONFIG_H
 #define INDEX_MAX_KEYS     16
 #define FUNC_MAX_ARGS      INDEX_MAX_KEYS
 
-/*
- * System default value for pg_attribute.attstattarget
- */
-#define DEFAULT_ATTSTATTARGET  10
-
 /*
  * Define this to make libpgtcl's "pg_result -assign" command process C-style
  * backslash sequences in returned tuple data and convert Postgres array