From c398300330cb3060d50652800dbd12729ab9f5ef Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 9 Feb 2007 03:35:35 +0000 Subject: 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. --- src/backend/access/common/heaptuple.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/backend/access/common/heaptuple.c') diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 6200f953eb..470f48777d 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); -- cgit v1.2.1