Re: A space-efficient, user-friendly way to store categorical data - Mailing list pgsql-hackers

From Andres Freund
Subject Re: A space-efficient, user-friendly way to store categorical data
Date
Msg-id 20180213062837.de3qsetqicetuje3@alap3.anarazel.de
Whole thread Raw
In response to Re: A space-efficient, user-friendly way to store categorical data  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
List pgsql-hackers
Hi,

On 2018-02-12 09:54:29 +1030, Andrew Dunstan wrote:
> The idea is to have an append-only list of labels
> which would not obey transactional semantics, and would thus help us
> avoid the pitfalls of enums - there wouldn't be any rollback of an
> addition.

FWIW, I think we can resolve the issues of enum transactionality. While
not trivial I think the solution is to allow to make additions of enum
values non-transactional (by basically inserting them with immediate
visibility) *while* in a transaction, and to change deletion of values
to set a 'deleted' column to true.

With some additional effort we could even make additions transactional
by storing the xid that added the enum label along the row. Visibility
for index comparisons would regard labels as visible regardless of that
xid, but when creating new values we'd make a visibility check. The big
issue with that is that autovacuum has to know about it...

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: rename sgml files?
Next
From: Thomas Munro
Date:
Subject: Re: [HACKERS] GSoC 2017: weekly progress reports (week 4) and patchfor hash index