Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcCb9-0000tf-HS for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jul 2017 15:27:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dcCb9-00062K-0g for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jul 2017 15:27:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dcCb8-00062B-AD for pgsql-hackers@postgresql.org; Mon, 31 Jul 2017 15:27:10 +0000 Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dcCaw-000489-Pu for pgsql-hackers@postgresql.org; Mon, 31 Jul 2017 15:27:09 +0000 Received: by mail-qk0-x22b.google.com with SMTP id d145so143696390qkc.2 for ; Mon, 31 Jul 2017 08:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=eNk2TFz/mom3hFBjQjBX5esEVuNBTg1dJlIz48FqIuc=; b=z+6olS4rLam1ywIshg1jnCDyjFupOOxoG+KCmHPT53Bk77nk23vGcUreJhxS7EtWcp yNlIxpMMy+QT/Pzbx8FUkNj6hvsZngTA9oOlPRyno/vWrzFaRF7GGc3WNxcFYrapoJm4 P2Xmes9biDYUUB+oedWVa5RbuBj6MDS0eukqVacmCzV/jLqfBc5umbbDyAFTu5KYWmKm 8/S0gThJ3sNcZiEViZMwSCdzYLs6uCwYMZ2y+G1OIyxYw+/pAdmr9aCQAbptIoAhgj7B 7RPj7h+QZozlSqNc116wrrrx5RV5ZpGgEifwReCy/bapFNhwDW8BWPspVs9/sHGy5436 EOLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=eNk2TFz/mom3hFBjQjBX5esEVuNBTg1dJlIz48FqIuc=; b=k3/EQGBPC+wKhL59iRmu4qEqxbnHVkNv1osv822t+O2WHGbGvIiawV0SEGRRPCBrZS C4rAXQGrdTONd6IdJAo4fGGbXMSc5P3HhGzfJO1YbFbXaJSoxtRohxkQr5oGUymbva5Q BC+o+jfxRmy3xFblnNUjvv0NA2SS1CwAXFQLVaMt9ruxgcpR6VSf0KcBsWQMu+plwkCr 93ilfsOR8Pwx8SvCWIgF0tGgCmioBuThek/wVD7+n94iJfBVOhBgcHwJef40r9SeehfJ 3ijsCRmGpAV5rAJ0eVHR3AE1vs7h9Qfu1YkOpweNpVVd4thgabvzUUXnH3HuNSIGFtQa XLgw== X-Gm-Message-State: AIVw110jasEV9PCiSHXZXsw75QL6pPv6HNcXxE33UP23bAm6hBf1dJVp fdHnMtwdTNJCV/DW X-Received: by 10.55.165.205 with SMTP id o196mr20183122qke.117.1501514817644; Mon, 31 Jul 2017 08:26:57 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([179.57.115.10]) by smtp.gmail.com with ESMTPSA id k127sm17205248qkf.59.2017.07.31.08.26.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Jul 2017 08:26:57 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 56DA04BA1; Mon, 31 Jul 2017 11:18:05 -0400 (-04) Date: Mon, 31 Jul 2017 11:18:05 -0400 From: Alvaro Herrera To: Tom Lane Cc: Mark Rofail , pgsql-hackers , Robert Haas , Alexander Korotkov , David Steele , Stephen Frost , pgsql-hackers-owner@postgresql.org, Erik Rijkers Subject: Re: GSoC 2017: Foreign Key Arrays Message-ID: <20170731151805.nonu6qwv54ca4qvv@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <17185.1501392410@sss.pgh.pa.us> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Tom Lane wrote: > Alvaro Herrera 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