Re: NOT LIKE much faster than LIKE?

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Andrea Arcangeli <andrea(at)cpushare(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: NOT LIKE much faster than LIKE?
Date: 2006-01-11 18:40:32
Message-ID: 20060111184032.GS3902@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2006-01-11 19:02:09 Re: Postgres8.0 planner chooses WRONG plan
Previous Message Jim C. Nasby 2006-01-11 18:25:45 Re: Improving Inner Join Performance