Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fboJG-0005SX-Hk for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Jul 2018 14:35:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fboJE-0005zR-T8 for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Jul 2018 14:35:36 +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.89) (envelope-from ) id 1fboJE-0005zK-Jv for pgsql-bugs@lists.postgresql.org; Sat, 07 Jul 2018 14:35:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fboJA-0003DB-Jj for pgsql-bugs@lists.postgresql.org; Sat, 07 Jul 2018 14:35:35 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w67EZUp8023633; Sat, 7 Jul 2018 10:35:30 -0400 From: Tom Lane To: Grigory Smolkin cc: pgsql-bugs@lists.postgresql.org, Peter Eisentraut Subject: Re: long analyze, libc bug and libicu In-reply-to: <2da0c289-bfc8-a40f-e13b-1b2943746e9e@postgrespro.ru> References: <2da0c289-bfc8-a40f-e13b-1b2943746e9e@postgrespro.ru> Comments: In-reply-to Grigory Smolkin message dated "Sat, 07 Jul 2018 12:18:59 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <70602.1530974130.1@sss.pgh.pa.us> Date: Sat, 07 Jul 2018 10:35:30 -0400 Message-ID: <70603.1530974130@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Grigory Smolkin writes: > On 07/07/2018 10:10 AM, Peter Eisentraut wrote: >> On 05.07.18 17:05, Grigory Smolkin wrote: >>> Why ANALYZE igrones column COLLATE? >> I think the statistics would be mostly the same independent of which >> collation you use. This could possibly be refined, but I don't think >> it's a major problem right now. I don't actually believe that the stats would be mostly the same. Yes, we ought to arrive at the same MCV list, ndistinct, etc, but the histogram depends critically on the sort order. In particular its endpoints, and estimates for comparison values near the endpoints, might be very much different. However, this is something that was left for future research when we added collations, and nobody's really followed up on that. Should ANALYZE/the planner care about collation (perhaps only for specific stats types)? Does that go as far as ignoring stats that don't match the query operator's collation? Should we consider recording stats for more than one collation, and if so which ones? What are the backwards-compatibility issues involved in changing something like this? Grigory's proposal amounts to assuming that the column's assigned collation is the only one of interest, which might be true but it needs some defense. In any case it wouldn't end up being a three-line patch; there's a whole lot of downstream work to consider. But besides that, I've got no sympathy for forcing through a change in this area just on the grounds that some platform's strcoll_l is ridiculously slow with certain collations. The right answer for that is to lobby the libc maintainers to fix strcoll_l, especially since the odds of us changing this in released branches are nil. regards, tom lane