diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-09 03:35:35 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-09 03:35:35 +0000 |
commit | c398300330cb3060d50652800dbd12729ab9f5ef (patch) | |
tree | 53d16880d6a38ffe3f6ddd125d644e1e984d14d1 /src/backend/access/common/heaptuple.c | |
parent | acb3416686d44885b6f7d40daacb8e4c1a28e366 (diff) | |
download | postgresql-c398300330cb3060d50652800dbd12729ab9f5ef.tar.gz postgresql-c398300330cb3060d50652800dbd12729ab9f5ef.zip |
Combine cmin and cmax fields of HeapTupleHeaders into a single field, by
keeping private state in each backend that has inserted and deleted the same
tuple during its current top-level transaction. This is sufficient since
there is no need to be able to determine the cmin/cmax from any other
transaction. This gets us back down to 23-byte headers, removing a penalty
paid in 8.0 to support subtransactions. Patch by Heikki Linnakangas, with
minor revisions by moi, following a design hashed out awhile back on the
pghackers list.
Diffstat (limited to 'src/backend/access/common/heaptuple.c')
-rw-r--r-- | src/backend/access/common/heaptuple.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 6200f953ebc..470f48777de 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -16,7 +16,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.114 2007/01/09 22:00:59 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.115 2007/02/09 03:35:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -582,14 +582,18 @@ heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) case MinTransactionIdAttributeNumber: result = TransactionIdGetDatum(HeapTupleHeaderGetXmin(tup->t_data)); break; - case MinCommandIdAttributeNumber: - result = CommandIdGetDatum(HeapTupleHeaderGetCmin(tup->t_data)); - break; case MaxTransactionIdAttributeNumber: result = TransactionIdGetDatum(HeapTupleHeaderGetXmax(tup->t_data)); break; + case MinCommandIdAttributeNumber: case MaxCommandIdAttributeNumber: - result = CommandIdGetDatum(HeapTupleHeaderGetCmax(tup->t_data)); + /* + * cmin and cmax are now both aliases for the same field, + * which can in fact also be a combo command id. XXX perhaps we + * should return the "real" cmin or cmax if possible, that is + * if we are inside the originating transaction? + */ + result = CommandIdGetDatum(HeapTupleHeaderGetRawCommandId(tup->t_data)); break; case TableOidAttributeNumber: result = ObjectIdGetDatum(tup->t_tableOid); |