diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-07-25 19:13:00 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-07-25 19:13:00 +0000 |
| commit | e6284649b9e30372b3990107a082bc7520325676 (patch) | |
| tree | 7c1075578244b4ce410c8185617dca4a7f7c44a5 /src/backend/access/nbtree/nbtpage.c | |
| parent | edd49fcf69a8d3e044adc7f0794dc8d18e3f994b (diff) | |
Modify btree to delete known-dead index entries without an actual VACUUM.
When we are about to split an index page to do an insertion, first look
to see if any entries marked LP_DELETE exist on the page, and if so remove
them to try to make enough space for the desired insert. This should reduce
index bloat in heavily-updated tables, although of course you still need
VACUUM eventually to clean up the heap.
Junji Teramoto
Diffstat (limited to 'src/backend/access/nbtree/nbtpage.c')
| -rw-r--r-- | src/backend/access/nbtree/nbtpage.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c index e069495f94f..080e10c88cf 100644 --- a/src/backend/access/nbtree/nbtpage.c +++ b/src/backend/access/nbtree/nbtpage.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.98 2006/07/13 16:49:12 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.99 2006/07/25 19:13:00 tgl Exp $ * * NOTES * Postgres btree pages look like ordinary relation pages. The opaque @@ -668,6 +668,15 @@ _bt_delitems(Relation rel, Buffer buf, opaque = (BTPageOpaque) PageGetSpecialPointer(page); opaque->btpo_cycleid = 0; + /* + * Mark the page as not containing any LP_DELETE items. This is not + * certainly true (there might be some that have recently been marked, + * but weren't included in our target-item list), but it will almost + * always be true and it doesn't seem worth an additional page scan + * to check it. Remember that BTP_HAS_GARBAGE is only a hint anyway. + */ + opaque->btpo_flags &= ~BTP_HAS_GARBAGE; + MarkBufferDirty(buf); /* XLOG stuff */ |
