| From: | "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> |
|---|---|
| To: | "Xiao Meng" <mx(dot)cogito(at)gmail(dot)com> |
| Cc: | <pgsql-hackers(at)postgresql(dot)org>, "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
| Subject: | Re: Is there anyway to create a TupleDesc with uint32 attribute easily? |
| Date: | 2008-07-15 12:04:16 |
| Message-ID: | 487C9240.5090900@enterprisedb.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Xiao Meng wrote:
> Hi, hackers.
> I'm working on my gsoc project - improving hash index.
> I need to create a TupldeDesc with uint32 attribute.
> Here is the reason why I need it -
> If we store hash code only in the tuple, then the TupleDesc's
> attribute should be uint32
Something along the lines of:
TupleDesc tupdesc = CreateTemplateTupleDesc(1, false);
TupleDescInitEntry(tupdesc, 1, "hashcode", INT4OID, -1, 0);
> In this way, we can use index_form_tuple() to create a tuple and
> needn't write a function for hash specially.
I would actually suggest ditching the normal page layout with line
pointers and IndexTuples altogether. All the entries are fixed size, so
you can get away with a much simpler structure, and store more entries
per page. Storing an IndexTuple with one int32 column takes
(sizeof(IndexTupleData) + sizeof(uint32) + sizeof(ItemIdData)) = 16 bytes,
but you only need a pointer to the heap tuple, and the hash code, which
is just 10 bytes in total. Or 12 if you have to align the hash code to 4
byte boundary.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Xiao Meng | 2008-07-15 12:18:45 | Re: Is there anyway to create a TupleDesc with uint32 attribute easily? |
| Previous Message | Abhijit Menon-Sen | 2008-07-15 11:38:20 | [PATCH] "\ef <function>" in psql |