Re: Proposal: Global Index

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Peter Geoghegan <pg(at)bowt(dot)ie>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Langote <amitlangote09(at)gmail(dot)com>, Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, "heikki(dot)linnakangas" <heikki(dot)linnakangas(at)iki(dot)fi>
Subject: Re: Proposal: Global Index
Date: 2019-10-31 19:21:55
Message-ID: 20191031192155.w3trwmemxcc4nhtu@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 31, 2019 at 03:02:40PM -0400, Isaac Morland wrote:
>On Thu, 31 Oct 2019 at 14:50, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>
>> Greetings,
>>
>> * Peter Geoghegan (pg(at)bowt(dot)ie) wrote:
>>
>[....]
>
>>
>> Absolutely- our lack of such is a common point of issue when folks are
>> considering using or migrating to PostgreSQL.
>>
>
>Not sure how similar my situation really is, but I find myself wanting to
>have indices that cross non-partition members of an inheritance hierarchy:
>
>create table t (
> id int,
> primary key (id)
>);
>
>create table t1 (
> a text
>) inherits (t);
>
>create table t2 (
> b int,
> c int
>) inherits (t);
>
>So "t"s are identified by an integer; and one kind of "t" has a single text
>attribute while a different kind of "t" has 2 int attributes. The idea is
>that there is a single primary key constraint on the whole hierarchy that
>ensures only one record with a particular id can exist in all the tables
>together. I can imagine wanting to do this with other unique constraints
>also.
>

IMO the chances of us supporting global indexes with generic inheritance
hierarchies are about zero. We don't even support creating "partition"
indexes on those hierarchies ...

>At present I don't actually use inheritance; instead I put triggers on the
>child tables that do an insert on the parent table, which has the effect of
>enforcing the uniqueness I want.

Does it? Are you sure it actually works in READ COMMITTED? What exactly
does the trigger do?

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-10-31 19:24:33 Re: Removing alignment padding for byval types
Previous Message Tomas Vondra 2019-10-31 19:15:12 Re: Removing alignment padding for byval types