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 B68F43A43EE for ; Wed, 24 Nov 2004 17:55:35 +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 90233-08 for ; Wed, 24 Nov 2004 17:55:33 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id B2A483A43D5 for ; Wed, 24 Nov 2004 17:55:27 +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 iAOHtNtT010878; Wed, 24 Nov 2004 12:55:23 -0500 (EST) To: sdfasdfas sdfasdfs Cc: pgsql-performance@postgresql.org Subject: Re: "Group By " index usage In-reply-to: <20041124173659.2441.qmail@web54301.mail.yahoo.com> References: <20041124173659.2441.qmail@web54301.mail.yahoo.com> Comments: In-reply-to sdfasdfas sdfasdfs message dated "Wed, 24 Nov 2004 18:36:59 +0100" Date: Wed, 24 Nov 2004 12:55:23 -0500 Message-ID: <10877.1101318923@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/386 X-Sequence-Number: 9340 sdfasdfas sdfasdfs writes: > I have a table with this index: > create index ARTISTS_NAME on ARTISTS ( > lower(AR_NAME) > ); > Te index is over a colum with this definition: > AR_NAME VARCHAR(256) null, > I want to optimize this query: > select * from artists where lower(ar_name) like > lower('a%') order by lower(ar_name) limit 20; > I think the planner should use the index i have. Update to 7.4, or declare the column as TEXT instead of VARCHAR. Older versions aren't very bright about situations involving implicit coercions. regards, tom lane