pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@cpushare.com>
To: Jim C. Nasby <jnasby@pervasive.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: NOT LIKE much faster than LIKE?
Date: Wed, 11 Jan 2006 21:39:47 +0100
Message-ID: <20060111203947.GL15897@opteron.random> (raw)
In-Reply-To: <20060111184032.GS3902@pervasive.com>
References: <20060110014447.GB18474@opteron.random>
	<20060111184032.GS3902@pervasive.com>

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.

> And then create a functional index on that:
> 
> CREATE INDEX indexname ON tablename ( position(' PREEMPT ' in kernel_version) );

The index only helps the above query with = 0 and not the one with != 0,
but it seems not needed in practice.



view thread (26+ messages)  latest in thread

Message-ID: <20060111203947.GL15897@opteron.random>
Permalink:  ../20060111203947.GL15897@opteron.random/
Also on:    postgresql.org/message-id/20060111203947.GL15897@opteron.random

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: andrea@cpushare.com, jnasby@pervasive.com
  Subject: Re: NOT LIKE much faster than LIKE?
  In-Reply-To: <20060111203947.GL15897@opteron.random>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox