pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: 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: Mon, 31 Jul 2017 11:18:05 -0400
Message-ID: <20170731151805.nonu6qwv54ca4qvv@alvherre.pgsql> (raw)
In-Reply-To: <17185.1501392410@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Tom Lane wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > ...  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.
> 
> Uh, what?  Surely the semantics of count(distinct x) *must not* vary
> depending on what indexes happen to be available.

Err ...

> I think what you meant to say is that the planner may only choose an
> optimization of this sort when the index's opclass matches the one
> DISTINCT will use, ie the default for the data type.

Um, yeah, absolutely.

-- 
Á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: <20170731151805.nonu6qwv54ca4qvv@alvherre.pgsql>
Permalink:  ../20170731151805.nonu6qwv54ca4qvv@alvherre.pgsql/
Also on:    postgresql.org/message-id/20170731151805.nonu6qwv54ca4qvv@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, tgl@sss.pgh.pa.us, 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: <20170731151805.nonu6qwv54ca4qvv@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