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 362469DC89B for ; Wed, 11 Jan 2006 16:46:44 -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 80641-07 for ; Wed, 11 Jan 2006 16:46:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from opteron.random (217-133-42-200.b2b.tiscali.it [217.133.42.200]) by postgresql.org (Postfix) with ESMTP id 83B1E9DC8A9 for ; Wed, 11 Jan 2006 16:46:39 -0400 (AST) Received: by opteron.random (Postfix, from userid 500) id 02D061C16A7; Wed, 11 Jan 2006 21:46:39 +0100 (CET) Date: Wed, 11 Jan 2006 21:46:39 +0100 From: Andrea Arcangeli Cc: "Jim C. Nasby" , pgsql-performance@postgresql.org Subject: Re: NOT LIKE much faster than LIKE? Message-ID: <20060111204639.GM15897@opteron.random> References: <20060110014447.GB18474@opteron.random> <20060111184032.GS3902@pervasive.com> <20060111203947.GL15897@opteron.random> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060111203947.GL15897@opteron.random> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.214 required=5 tests=[AWL=0.025, MISSING_HEADERS=0.189] X-Spam-Score: 0.214 X-Spam-Level: X-Archive-Number: 200601/124 X-Sequence-Number: 16602 On Wed, Jan 11, 2006 at 09:39:47PM +0100, Andrea Arcangeli wrote: > On Wed, Jan 11, 2006 at 12:40:32PM -0600, Jim C. Nasby wrote: > > 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 > > That alone fixed it, with this I don't even need the index (yet). Thanks > a lot. The fix is online already w/o index: http://klive.cpushare.com/?branch=all&scheduler=preemptive Of course I'm still fully available to test any fix for the previous LIKE query if there's interest.