diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-09-16 16:58:44 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-09-16 16:58:44 +0000 |
commit | 8f9f1986034a2273e09ad10671e10d1adda21d1f (patch) | |
tree | 4c2c8a226db335cf1e653b09026402363d0488e7 /src/include/executor/spi.h | |
parent | 42c0d1f3cd01ac737b182353934531d1fd382c80 (diff) |
Restructure subtransaction handling to reduce resource consumption,
as per recent discussions. Invent SubTransactionIds that are managed like
CommandIds (ie, counter is reset at start of each top transaction), and
use these instead of TransactionIds to keep track of subtransaction status
in those modules that need it. This means that a subtransaction does not
need an XID unless it actually inserts/modifies rows in the database.
Accordingly, don't assign it an XID nor take a lock on the XID until it
tries to do that. This saves a lot of overhead for subtransactions that
are only used for error recovery (eg plpgsql exceptions). Also, arrange
to release a subtransaction's XID lock as soon as the subtransaction
exits, in both the commit and abort cases. This avoids holding many
unique locks after a long series of subtransactions. The price is some
additional overhead in XactLockTableWait, but that seems acceptable.
Finally, restructure the state machine in xact.c to have a more orthogonal
set of states for subtransactions.
Diffstat (limited to 'src/include/executor/spi.h')
-rw-r--r-- | src/include/executor/spi.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index d58f66ad314..3014dbce840 100644 --- a/src/include/executor/spi.h +++ b/src/include/executor/spi.h @@ -2,7 +2,7 @@ * * spi.h * - * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.48 2004/09/13 20:07:53 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.49 2004/09/16 16:58:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -126,6 +126,6 @@ extern void SPI_cursor_move(Portal portal, bool forward, int count); extern void SPI_cursor_close(Portal portal); extern void AtEOXact_SPI(bool isCommit); -extern void AtEOSubXact_SPI(bool isCommit, TransactionId childXid); +extern void AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid); #endif /* SPI_H */ |