X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CB845475AE5 for ; Sat, 29 Mar 2003 18:13:59 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 1368C4758E6 for ; Sat, 29 Mar 2003 18:13:59 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.8/8.12.8) with ESMTP id h2TNDTub000936; Sat, 29 Mar 2003 18:13:29 -0500 (EST) To: Andreas Kostyrka Cc: Christopher Kings-Lynne , pgsql-performance@postgresql.org Subject: Re: Index not used, performance problem In-reply-to: <1048957078.7539.17.camel@andi-lap> References: <20030329214139.N4697-100000@houston.familyhealth.com.au> <1048957078.7539.17.camel@andi-lap> Comments: In-reply-to Andreas Kostyrka message dated "29 Mar 2003 17:57:58 +0100" Date: Sat, 29 Mar 2003 18:13:28 -0500 Message-ID: <935.1048979608@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-32.5 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/197 X-Sequence-Number: 1495 Andreas Kostyrka writes: > On Sat, 2003-03-29 at 14:47, Christopher Kings-Lynne wrote: >> As for the LIKE searches, the only ones that PostgreSQL can index are of >> the form 'FOO%', which is what you are doing. However, I believe that >> PostgreSQL cannot do this if your database encoding is anything other than >> 'C'. So, if you are using an Austrian encoding, it might not be able to >> use the index. > Well, I use LATIN1. How do I store 8-bit chars else? You are both confusing locale with encoding. The LIKE optimization requires 'C' locale, but it should work with any encoding (or at least any single-byte encoding; not sure about multibyte). > And if so, PostgreSQL seems quite strongly broken, because a > relational database relies by design heavily on indexes. Some of us would reply that the locales are broken ;-). The bizarre sorting rules demanded by so many locales are what make it impossible to optimize a LIKE prefix into an indexscan. See the archives for the reasons why our many tries at this have failed. regards, tom lane