summaryrefslogtreecommitdiff
path: root/src/include/storage/sinvaladt.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-09-05 18:10:48 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-09-05 18:10:48 +0000
commit295e63983d7596ccc5717ff4a0a235ba241a2614 (patch)
treed4d8baaed4992dab3a4ae5110f765237da136cb3 /src/include/storage/sinvaladt.h
parent2e74c53ec1103f92c5704d87a4af2ab573402212 (diff)
downloadpostgresql-295e63983d7596ccc5717ff4a0a235ba241a2614.tar.gz
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.
Diffstat (limited to 'src/include/storage/sinvaladt.h')
-rw-r--r--src/include/storage/sinvaladt.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h
index 778d7a4a2b..ff0a68e25a 100644
--- a/src/include/storage/sinvaladt.h
+++ b/src/include/storage/sinvaladt.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/sinvaladt.h,v 1.42 2007/01/05 22:19:58 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/sinvaladt.h,v 1.43 2007/09/05 18:10:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -86,6 +86,13 @@ typedef struct SISeg
int freeBackends; /* number of empty procState slots */
/*
+ * Next LocalTransactionId to use for each idle backend slot. We keep
+ * this here because it is indexed by BackendId and it is convenient to
+ * copy the value to and from local memory when MyBackendId is set.
+ */
+ LocalTransactionId *nextLXID; /* array of maxBackends entries */
+
+ /*
* Circular buffer holding shared-inval messages
*/
SharedInvalidationMessage buffer[MAXNUMMESSAGES];
@@ -114,4 +121,6 @@ extern int SIGetDataEntry(SISeg *segP, int backendId,
SharedInvalidationMessage *data);
extern void SIDelExpiredDataEntries(SISeg *segP);
+extern LocalTransactionId GetNextLocalTransactionId(void);
+
#endif /* SINVALADT_H */