Phantom Command ID

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Phantom Command ID
Date: 2006-09-20 18:27:27
Message-ID: 4511880F.6030102@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Per discussion on reducing heap tuple header, I've started to work on
the phantom cid idea.

I'm thinking of having an array of cmin,cmax pairs, indexed by phantom
cid number. Looking up cmin,cmax of a phantom id is then a simple array
lookup. To allow reusing phantom cids, we have a hash table that allows
looking up a phantomid by cmin,cmax pair.

A big question is, do we need to implement spilling to disk?

With the above data structures, each phantom cid is going to take 28
bytes of backend-private memory [See math below]. Transactions that
actually need phantom cids are not that common, but I suppose that
applications that make heavy use of plpgsql functions or do a lot of
repeated UPDATES of same rows might need millions.

[quick sizing math]
array element = sizeof(cmin) + sizeof(cmax) = 4 + 4 = 8
hash table key + data + hash element overhead = sizeof(cmin) +
sizeof(cmax) + sizeof(phantomcid) + sizeof(HASHELEMENT) = 20
Total: 28 bytes (or 32 if MAXALIGN is 8-bytes)

this excludes overhead of hash table buckets etc.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2006-09-20 18:49:16 Re: pg_upgrade: downgradebility
Previous Message Mark Dilger 2006-09-20 17:56:08 Re: TODO: Fix CREATE CAST on DOMAINs