mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
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.
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user