X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E95879DC83F for ; Wed, 18 Jan 2006 19:02:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39654-04 for ; Wed, 18 Jan 2006 19:02:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 924FF9DC899 for ; Wed, 18 Jan 2006 19:02:27 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 6486339820; Wed, 18 Jan 2006 17:02:30 -0600 (CST) Date: Wed, 18 Jan 2006 17:02:30 -0600 From: "Jim C. Nasby" To: Marcos Cc: pgsql-performance@postgresql.org Subject: Re: Simple Question of Performance ILIKE or Lower Message-ID: <20060118230230.GZ17896@pervasive.com> References: <1137575430.966.10.camel@servidor> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1137575430.966.10.camel@servidor> X-Operating-System: FreeBSD 6.0-RELEASE amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200601/317 X-Sequence-Number: 16795 On Wed, Jan 18, 2006 at 09:10:30AM +0000, Marcos wrote: > Hi, > > I have a simple question about performance using two resources. > > What's have the best performance? > > lower( col1 ) LIKE lower( 'myquestion%' ) > > OR > > col1 ILIKE 'myquestion%' If you index lower( col1 ), then the former would likely perform better (if the optimizer knows it could use the index in that case). Otherwise I suspect they'd be the same. Try it and find out. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461