diff options
| author | Tom Lane | 2006-05-10 23:18:39 +0000 |
|---|---|---|
| committer | Tom Lane | 2006-05-10 23:18:39 +0000 |
| commit | 3fdeb189e977ebe29ee658592d07930e016dd031 (patch) | |
| tree | 1233c6b5d693bbfb76839b502692465d09d28421 /src/include/access | |
| parent | c1f39437d0ad38d1f8d76f9ebf904faa9a7aaaf6 (diff) | |
Clean up code associated with updating pg_class statistics columns
(relpages/reltuples). To do this, create formal support in heapam.c for
"overwrite" tuple updates (including xlog replay capability) and use that
instead of the ad-hoc overwrites we'd been using in VACUUM and CREATE INDEX.
Take the responsibility for updating stats during CREATE INDEX out of the
individual index AMs, and do it where it belongs, in catalog/index.c. Aside
from being more modular, this avoids having to update the same tuple twice in
some paths through CREATE INDEX. It's probably not measurably faster, but
for sure it's a lot cleaner than before.
Diffstat (limited to 'src/include/access')
| -rw-r--r-- | src/include/access/genam.h | 11 | ||||
| -rw-r--r-- | src/include/access/heapam.h | 3 | ||||
| -rw-r--r-- | src/include/access/htup.h | 13 |
3 files changed, 23 insertions, 4 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h index 67a9ef60ee..c1859a0c6d 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.59 2006/05/02 22:25:10 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.60 2006/05/10 23:18:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,6 +21,15 @@ /* + * Struct for statistics returned by ambuild + */ +typedef struct IndexBuildResult +{ + double heap_tuples; /* # of tuples seen in parent table */ + double index_tuples; /* # of tuples inserted into index */ +} IndexBuildResult; + +/* * Struct for input arguments passed to ambulkdelete and amvacuumcleanup * * Note that num_heap_tuples will not be valid during ambulkdelete, diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index fdf2e8d86f..e016a52740 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.110 2006/04/24 22:24:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.111 2006/05/10 23:18:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -168,6 +168,7 @@ extern HTSU_Result heap_lock_tuple(Relation relation, HeapTuple tuple, Buffer *buffer, ItemPointer ctid, TransactionId *update_xmax, CommandId cid, LockTupleMode mode, bool nowait); +extern void heap_inplace_update(Relation relation, HeapTuple tuple); extern Oid simple_heap_insert(Relation relation, HeapTuple tup); extern void simple_heap_delete(Relation relation, ItemPointer tid); diff --git a/src/include/access/htup.h b/src/include/access/htup.h index 9dacfcb852..57db9f8493 100644 --- a/src/include/access/htup.h +++ b/src/include/access/htup.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.81 2006/03/05 15:58:53 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.82 2006/05/10 23:18:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -444,7 +444,7 @@ typedef HeapTupleData *HeapTuple; #define XLOG_HEAP_CLEAN 0x40 #define XLOG_HEAP_NEWPAGE 0x50 #define XLOG_HEAP_LOCK 0x60 -/* opcode 0x70 still free */ +#define XLOG_HEAP_INPLACE 0x70 #define XLOG_HEAP_OPMASK 0x70 /* * When we insert 1st item on new page in INSERT/UPDATE @@ -545,4 +545,13 @@ typedef struct xl_heap_lock #define SizeOfHeapLock (offsetof(xl_heap_lock, shared_lock) + sizeof(bool)) +/* This is what we need to know about in-place update */ +typedef struct xl_heap_inplace +{ + xl_heaptid target; /* updated tuple id */ + /* TUPLE DATA FOLLOWS AT END OF STRUCT */ +} xl_heap_inplace; + +#define SizeOfHeapInplace (offsetof(xl_heap_inplace, target) + SizeOfHeapTid) + #endif /* HTUP_H */ |
