summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2004-12-01 19:00:56 +0000
committerTom Lane2004-12-01 19:00:56 +0000
commit5374d097de4d7321f03df7899816e61502438b32 (patch)
treee7dae5fe8181c528568b4a8bb9ca1aa4c7261831 /src/include
parentb7bcea64ecca27e67dbc81525a71fcc0da396b36 (diff)
Change planner to use the current true disk file size as its estimate of
a relation's number of blocks, rather than the possibly-obsolete value in pg_class.relpages. Scale the value in pg_class.reltuples correspondingly to arrive at a hopefully more accurate number of rows. When pg_class contains 0/0, estimate a tuple width from the column datatypes and divide that into current file size to estimate number of rows. This improved methodology allows us to jettison the ancient hacks that put bogus default values into pg_class when a table is first created. Also, per a suggestion from Simon, make VACUUM (but not VACUUM FULL or ANALYZE) adjust the value it puts into pg_class.reltuples to try to represent the mean tuple density instead of the minimal density that actually prevails just after VACUUM. These changes alter the plans selected for certain regression tests, so update the expected files accordingly. (I removed join_1.out because it's not clear if it still applies; we can add back any variant versions as they are shown to be needed.)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/genam.h7
-rw-r--r--src/include/nodes/relation.h4
2 files changed, 8 insertions, 3 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index 01874b1fd62..bfbebb6ca4d 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.45 2004/08/29 04:13:03 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.46 2004/12/01 19:00:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,10 +28,15 @@
* an index AM could choose to have bulk-delete return a larger struct
* of which this is just the first field; this provides a way for bulk-delete
* to communicate additional private data to vacuum-cleanup.
+ *
+ * Note: pages_removed is the amount by which the index physically shrank,
+ * if any (ie the change in its total size on disk). pages_deleted and
+ * pages_free refer to free space within the index file.
*/
typedef struct IndexBulkDeleteResult
{
BlockNumber num_pages; /* pages remaining in index */
+ BlockNumber pages_removed; /* # removed by bulk-delete operation */
double num_index_tuples; /* tuples remaining */
double tuples_removed; /* # removed by bulk-delete operation */
BlockNumber pages_deleted; /* # unused pages in index */
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index 8d0d6a60ba2..c07f8e1f962 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.100 2004/11/26 21:08:35 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.101 2004/12/01 19:00:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -255,7 +255,7 @@ typedef struct IndexOptInfo
Oid indexoid; /* OID of the index relation */
/* statistics from pg_class */
- long pages; /* number of disk pages in index */
+ BlockNumber pages; /* number of disk pages in index */
double tuples; /* number of index tuples in index */
/* index descriptor information */