mirror of
https://github.com/postgres/postgres.git
synced 2025-07-24 14:22:24 +03:00
Implement lazy XID allocation: transactions that do not modify any database
rows will normally never obtain an XID at all. We already did things this way for subtransactions, but this patch extends the concept to top-level transactions. In applications where there are lots of short read-only transactions, this should improve performance noticeably; not so much from removal of the actual XID-assignments, as from reduction of overhead that's driven by the rate of XID consumption. We add a concept of a "virtual transaction ID" so that active transactions can be uniquely identified even if they don't have a regular XID. This is a much lighter-weight concept: uniqueness of VXIDs is only guaranteed over the short term, and no on-disk record is made about them. Florian Pflug, with some editorialization by Tom.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.237 2007/08/14 17:35:18 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.238 2007/09/05 18:10:47 tgl Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@ -1632,12 +1632,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
|
||||
MarkBufferDirty(buffer);
|
||||
|
||||
/* XLOG stuff */
|
||||
if (relation->rd_istemp)
|
||||
{
|
||||
/* No XLOG record, but still need to flag that XID exists on disk */
|
||||
MyXactMadeTempRelUpdate = true;
|
||||
}
|
||||
else if (use_wal)
|
||||
if (use_wal && !relation->rd_istemp)
|
||||
{
|
||||
xl_heap_insert xlrec;
|
||||
xl_heap_header xlhdr;
|
||||
@ -1947,11 +1942,6 @@ l1:
|
||||
PageSetLSN(dp, recptr);
|
||||
PageSetTLI(dp, ThisTimeLineID);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No XLOG record, but still need to flag that XID exists on disk */
|
||||
MyXactMadeTempRelUpdate = true;
|
||||
}
|
||||
|
||||
END_CRIT_SECTION();
|
||||
|
||||
@ -2403,11 +2393,6 @@ l2:
|
||||
PageSetLSN(BufferGetPage(buffer), recptr);
|
||||
PageSetTLI(BufferGetPage(buffer), ThisTimeLineID);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No XLOG record, but still need to flag that XID exists on disk */
|
||||
MyXactMadeTempRelUpdate = true;
|
||||
}
|
||||
|
||||
END_CRIT_SECTION();
|
||||
|
||||
@ -2924,11 +2909,6 @@ l3:
|
||||
PageSetLSN(dp, recptr);
|
||||
PageSetTLI(dp, ThisTimeLineID);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No XLOG record, but still need to flag that XID exists on disk */
|
||||
MyXactMadeTempRelUpdate = true;
|
||||
}
|
||||
|
||||
END_CRIT_SECTION();
|
||||
|
||||
|
Reference in New Issue
Block a user