Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bWR4p-0005YF-Fk for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Aug 2016 16:37:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bWR4o-0006cs-39 for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Aug 2016 16:37:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bWR3R-00050y-Tr for pgsql-hackers@postgresql.org; Sun, 07 Aug 2016 16:36:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bWR3P-0003nf-6q for pgsql-hackers@postgresql.org; Sun, 07 Aug 2016 16:36:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u77GZuRS024136; Sun, 7 Aug 2016 12:35:56 -0400 From: Tom Lane To: Dean Rasheed cc: Andrew Gierth , PostgreSQL Hackers , Andreas Joseph Krogh Subject: Re: Bogus ANALYZE results for an otherwise-unique column with many nulls In-reply-to: References: <16143.1470350371@sss.pgh.pa.us> <871t23fwgb.fsf@news-spur.riddles.org.uk> <87wpjvecwz.fsf@news-spur.riddles.org.uk> <4174.1470407261@sss.pgh.pa.us> <87oa57dsnn.fsf@news-spur.riddles.org.uk> <25440.1470430114@sss.pgh.pa.us> Comments: In-reply-to Dean Rasheed message dated "Sun, 07 Aug 2016 08:01:40 +0100" Date: Sun, 07 Aug 2016 12:35:56 -0400 Message-ID: <24135.1470587756@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) 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 Dean Rasheed writes: > On 5 August 2016 at 21:48, Tom Lane wrote: >> OK, thanks. What shall we do about Andreas' request to back-patch this? >> I'm personally willing to do it, but there is the old bugaboo of "maybe >> it will destabilize a plan that someone is happy with". > My inclination would be to back-patch it because arguably it's a > bug-fix -- at the very least the old behaviour didn't match the docs > for stadistinct: Yeah. I suspect that situations like this are pretty rare, or we'd have recognized the problem sooner. And at least for Andreas, it'd be fixing a real problem. I'll apply the back-patch unless I hear objections in the next couple of hours. > Additionally, I think that example is misleading because it's only > really true if there are no null values in the column. Perhaps it > would help to have a more explicit example to illustrate how nulls > affect stadistinct, for example: Good idea, will do. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers