pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Mark Rofail <markm.rofail@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Alexander Korotkov <aekorotkov@gmail.com>
Cc: David Steele <david@pgmasters.net>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-hackers-owner@postgresql.org, Erik Rijkers <er@xs4all.nl>
Subject: Re: GSoC 2017: Foreign Key Arrays
Date: Sat, 29 Jul 2017 19:59:43 -0400
Message-ID: <20170729235943.ev5z6jgav67f4mf6@alvherre.pgsql> (raw)
In-Reply-To: <CAJvoCuv8w9Tzz4zrK84haWkKDpUGVvPiz1E4_EKYT-FnLZn=rw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Mark Rofail wrote:
> These are limitations of the patch ordered by importance:
> 
> ✗ presupposes that count(distinct y) has exactly the same notion of
> equality that the PK unique index has. In reality, count(distinct) will
> fall back to the default btree opclass for the array element type.

Operators are classified in operator classes; each data type may have
more than one operator class for a particular access method.  Exactly
one operator class for some access method can be designated as the
default one for a type.  However, when you create an index, you can
indicate which operator class to use, and it may not be the default one.
If a different one is chosen at index creation time, then a query using
COUNT(distinct) will do the wrong thing, because DISTINCT will select
an equality type using the type's default operator class, not the
equality that belongs to the operator class used to create the index.

That's wrong: DISTINCT should use the equality operator that corresponds
to the index' operator class instead, not the default one.

I hope that made sense.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (200+ messages)  latest in thread

Message-ID: <20170729235943.ev5z6jgav67f4mf6@alvherre.pgsql>
Permalink:  ../20170729235943.ev5z6jgav67f4mf6@alvherre.pgsql/
Also on:    postgresql.org/message-id/20170729235943.ev5z6jgav67f4mf6@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, markm.rofail@gmail.com, robertmhaas@gmail.com, aekorotkov@gmail.com, david@pgmasters.net, sfrost@snowman.net, er@xs4all.nl
  Subject: Re: GSoC 2017: Foreign Key Arrays
  In-Reply-To: <20170729235943.ev5z6jgav67f4mf6@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox