mirror of
https://github.com/postgres/postgres.git
synced 2025-10-16 17:07:43 +03:00
HOT updates. When we update a tuple without changing any of its indexed
columns, and the new version can be stored on the same heap page, we no longer generate extra index entries for the new version. Instead, index searches follow the HOT-chain links to ensure they find the correct tuple version. In addition, this patch introduces the ability to "prune" dead tuples on a per-page basis, without having to do a complete VACUUM pass to recover space. VACUUM is still needed to clean up dead index entries, however. Pavan Deolasee, with help from a bunch of other people.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.66 2007/09/12 22:10:26 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.67 2007/09/20 17:56:30 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ RelationPutHeapTuple(Relation relation,
|
||||
pageHeader = BufferGetPage(buffer);
|
||||
|
||||
offnum = PageAddItem(pageHeader, (Item) tuple->t_data,
|
||||
tuple->t_len, InvalidOffsetNumber, false);
|
||||
tuple->t_len, InvalidOffsetNumber, false, true);
|
||||
|
||||
if (offnum == InvalidOffsetNumber)
|
||||
elog(PANIC, "failed to add tuple to page");
|
||||
@@ -218,7 +218,7 @@ RelationGetBufferForTuple(Relation relation, Size len,
|
||||
* we're done.
|
||||
*/
|
||||
pageHeader = (Page) BufferGetPage(buffer);
|
||||
pageFreeSpace = PageGetFreeSpace(pageHeader);
|
||||
pageFreeSpace = PageGetHeapFreeSpace(pageHeader);
|
||||
if (len + saveFreeSpace <= pageFreeSpace)
|
||||
{
|
||||
/* use this page as future insert target, too */
|
||||
@@ -311,7 +311,7 @@ RelationGetBufferForTuple(Relation relation, Size len,
|
||||
|
||||
PageInit(pageHeader, BufferGetPageSize(buffer), 0);
|
||||
|
||||
if (len > PageGetFreeSpace(pageHeader))
|
||||
if (len > PageGetHeapFreeSpace(pageHeader))
|
||||
{
|
||||
/* We should not get here given the test at the top */
|
||||
elog(PANIC, "tuple is too big: size %lu", (unsigned long) len);
|
||||
|
Reference in New Issue
Block a user