Re: WIP: extensible enums - Mailing list pgsql-hackers

From Tom Lane
Subject Re: WIP: extensible enums
Date
Msg-id 3415.1287937222@sss.pgh.pa.us
Whole thread Raw
In response to Re: WIP: extensible enums  (Greg Stark <gsstark@mit.edu>)
Responses Re: WIP: extensible enums
Re: WIP: extensible enums
List pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> There's nothing magic about the integral types here. If you use a
> string then you could always split by making the string longer.

The entire objective here is to make enum comparisons fast.  Somehow,
going to a non-primitive data type to represent the sort values does
not seem like a win from that perspective.

(Likewise for Dean's suggestion for an array of another kind.)

What I'm currently thinking is that we should actually use float4 not
float8.  That eliminates any concerns about making the representation
larger than it was before.  We'll definitely have to have the logic
to do renumbering, but it'll still be an exceedingly rare thing in
practice.  With float4 the implementation would fail at somewhere
around 2^24 elements in an enum (since even with renumbering, there
wouldn't be enough bits to give each element a distinguishable value).
I don't see that as a real objection, and anyway if you were trying
to have an enum with many elements, you'd want the in-memory
representation to be compact.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Re: ask for review of MERGE
Next
From: Tom Lane
Date:
Subject: Re: PostgreSQL and HugePage