Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 152291337B6D for ; Fri, 12 Nov 2010 15:05:08 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 64458-03; Fri, 12 Nov 2010 19:05:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id C87841337B39; Fri, 12 Nov 2010 15:04:59 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id oACJ3rr5014525; Fri, 12 Nov 2010 14:03:53 -0500 (EST) To: Robert Haas cc: mark , Gabriele Bartolini , pgsql-admin@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [HACKERS] locales and encodings Oh MY! In-reply-to: References: <000001cb8211$c4c91b00$4e5b5100$@com> <4CDCF083.2040004@2ndQuadrant.it> Comments: In-reply-to Robert Haas message dated "Fri, 12 Nov 2010 13:53:40 -0500" Date: Fri, 12 Nov 2010 14:03:53 -0500 Message-ID: <14524.1289588633@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/105 X-Sequence-Number: 36071 Robert Haas writes: >> With how similar straight C and en_US.UTF8 are it was suggested to me, >> by persons who are far more C knowledgeable then I in my office, that >> this is something the PG community could "fix" . A "fix" being so that >> "col LIKE 'foo%' " could use btree indexes in locales like en_US.UTF8 >> (and probably some others). >> is the request unreasonable ? anyone got any idea of the price tag to >> make that happen ? > I thought it already did that. No, and the odds of it ever happening are insignificant. The sort order associated with en_US (and other "dictionary order" locales) is just too randomly different from what you need to optimize a LIKE search. (Whoever told you en_US sorts similarly to C is nuts.) The solution if you want the database's prevailing sort order to be en_US is to put an extra text_pattern_ops index on the column you want to do LIKE searches on. We might eventually have the ability to spell that "put a C-locale index on the column", but text_pattern_ops is the way to do it today. regards, tom lane