Re: Disallow unique index on system columns

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Disallow unique index on system columns
Date: 2016-04-15 02:35:19
Message-ID: CAKJS1f9_QJG-MV+OMf1FS83zFZns_HYEY62VJQF2dJ8tmBo-zA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 15 April 2016 at 13:56, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> writes:
>> On 15 April 2016 at 13:30, Andres Freund <andres(at)anarazel(dot)de> wrote:
>>> What'd be the point of indexing ctid, and why would it be correct?
>>> Wouldn't, hm, HOT break it?
>
>> I don't personally see the point.
>
> An index on ctid is useless by definition: if you know the ctid of
> a tuple, you can just go get it, never mind the index.

I'm not sure that's 100% accurate, and perhaps it's not worth arguing,
as they're likely broken because of HOT anyway, but it does seem like
you've totally disregarded the fact that a TIDscan does not support
range scanning, where an index scan on ctid would.

E.g; how many live tuples are on page 0?

select count(*) from t where ctid between '(0,0)' and '(0,10000)';

I'm not saying it's going to be a common case. I just want to ensure
we've considered all semi realistic use cases before we go and turn
this off.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-04-15 02:46:01 Re: [COMMITTERS] pgsql: Allow Pin/UnpinBuffer to operate in a lockfree manner.
Previous Message Andres Freund 2016-04-15 02:17:02 Re: [COMMITTERS] pgsql: Allow Pin/UnpinBuffer to operate in a lockfree manner.