X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 18E5B566A3 for ; Wed, 2 Mar 2005 01:42:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68304-07 for ; Wed, 2 Mar 2005 01:42:12 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 32DA656146 for ; Wed, 2 Mar 2005 01:42:11 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j221gEVX003458; Tue, 1 Mar 2005 20:42:14 -0500 (EST) To: Dan Harris Cc: pgsql-performance@postgresql.org Subject: Re: Confusion about locales and 'like' indexes In-reply-to: <124c40d023eab9ed34fda472fbb3db3f@drivefaster.net> References: <124c40d023eab9ed34fda472fbb3db3f@drivefaster.net> Comments: In-reply-to Dan Harris message dated "Tue, 01 Mar 2005 17:44:07 -0700" Date: Tue, 01 Mar 2005 20:42:14 -0500 Message-ID: <3457.1109727734@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/19 X-Sequence-Number: 10724 Dan Harris writes: > query that uses LIKE. In my research I have read that the locale > setting may affect PostgreSQL's choice of seq scan vs index scan. Non-C-locale indexes can't support LIKE because the sort ordering isn't necessarily right. > I am running Fedora Core 2 and it appears when I run "locale" that it > is set to 'en.US-UTF-8'. This is not a definitive indication of the environment the database sees, though. Try "show lc_collate". > I can pg_dump and initdb again with --locale=C if > this will allow my LIKE queries to use indexes, but I just wanted to > know if there was some other place I needed to change locales in the > system? e.g. postgresql.conf or env vars? Or, would the initdb and > reload alone fix it? That would do it. Alternatively you can create special-purpose indexes with one of the xxx_pattern_ops operator classes to support LIKE. regards, tom lane