Re: A space-efficient, user-friendly way to store categorical data

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Kane <andrew(at)chartkick(dot)com>
Cc: Mark Dilger <hornschnorter(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A space-efficient, user-friendly way to store categorical data
Date: 2018-02-13 02:35:29
Message-ID: 30424.1518489329@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Kane <andrew(at)chartkick(dot)com> writes:
> Thanks everyone for the feedback. The current enum implementation requires
> you to create a new type and add labels outside a transaction prior to an
> insert.

Right ...

> Since enums have a fixed number of labels, this type of feature may be
> better off as a property you could add to text columns (as Thomas
> mentions). This would avoid issues with hitting the max number of labels.

... but you're not saying how you'd avoid the need for prior commit of the
labels. The sticking point for enums is that once a value has gotten into
a btree index, we can't ever lose the ability to compare that value to
others, or the index will be broken. So inserting an uncommitted value
into user tables has to be prevented.

Maybe there's a way to assign the labels so that they can be compared
without reference to any outside data, but it's not clear to me how
that would work.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-02-13 02:35:50 Re: pgsql: Local partitioned indexes
Previous Message Peter Geoghegan 2018-02-13 02:15:31 Re: PostgreSQL crashes with SIGSEGV