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 3F2159DC833 for ; Wed, 11 Jan 2006 14:40:38 -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 41139-02 for ; Wed, 11 Jan 2006 14:40:34 -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 6ABF29DC94D for ; Wed, 11 Jan 2006 14:40:32 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id D4F303982E; Wed, 11 Jan 2006 12:40:32 -0600 (CST) Date: Wed, 11 Jan 2006 12:40:32 -0600 From: "Jim C. Nasby" To: Andrea Arcangeli Cc: pgsql-performance@postgresql.org Subject: Re: NOT LIKE much faster than LIKE? Message-ID: <20060111184032.GS3902@pervasive.com> References: <20060110014447.GB18474@opteron.random> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060110014447.GB18474@opteron.random> 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.087 required=5 tests=[AWL=0.087] X-Spam-Score: 0.087 X-Spam-Level: X-Archive-Number: 200601/119 X-Sequence-Number: 16597 On Tue, Jan 10, 2006 at 02:44:47AM +0100, Andrea Arcangeli wrote: > "cooperative" runs "WHERE kernel_version NOT LIKE '%% PREEMPT %%'", while > "preempt" runs "WHERE kernel_version LIKE '%% PREEMPT %%'. The only difference One thing you could do is change the like to: WHERE position(' PREEMPT ' in kernel_version) != 0 And then create a functional index on that: CREATE INDEX indexname ON tablename ( position(' PREEMPT ' in kernel_version) ); -- 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