X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2EE074758E6 for ; Wed, 9 Apr 2003 01:57:01 -0400 (EDT) Received: from localhost.localdomain (adsl-216-103-208-155.dsl.snfc21.pacbell.net [216.103.208.155]) by postgresql.org (Postfix) with ESMTP id 569A4474E42 for ; Wed, 9 Apr 2003 01:57:00 -0400 (EDT) Received: from flipper5 (flipper5.next2me.com [192.168.0.3]) by localhost.localdomain (8.12.8/8.12.8) with SMTP id h395wMgL002290; Tue, 8 Apr 2003 22:58:22 -0700 Reply-To: From: "Denis @ Next2Me" To: "Martijn van Oosterhout" , "Stephan Szabo" , "Denis @ Next2Me" Cc: Subject: Re: [GENERAL] Yet Another (Simple) Case of Index not used Date: Tue, 8 Apr 2003 22:54:46 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 In-Reply-To: <20030409031839.GE15928@svana.org> X-Spam-Status: No, hits=-14.7 required=5.0 tests=BAYES_10,IN_REP_TO,MSGID_GOOD_EXCHANGE autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/84 X-Sequence-Number: 1590 Stephan, Martijn, good call, that was it: the C locale. I had used all the default settings when installing/creating the database, and apparently it used my default locale (en_US). I recreated (initdb) the database with --no-locale, and recreated the database, and sure enough, the query: select count(*) from table where table.column like 'fol%' was a zillion (well almost) time faster than it used to be, and on pair with mysql's performance. And as expected, the EXPLAIN on that query does show indeed the use of the index I had created on the table. Sweet, I can now nuke mysql out of my system. Folks, thank you all for the help and other suggestions. Denis Amselem Next2Me Inc. Stephan said: > If it doesn't use the index (ie, it's still using a sequential scan) > after the enable_seqscan=off it's likely that you didn't initdb in "C" > locale in which case like won't use indexes currently (you can see the > archives for long description, but the short one is that some of the > locale rules can cause problems with using the index). Martijn said: > Ah, but that may be caused by something else altogether. LIKE is only > indexable in the C locale so if you have en_US as your locale, your LIKE > won't be indexable. See the discussion threads on this mailing list in the past. > >