Re: Speeding up LIKE with placeholders? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Speeding up LIKE with placeholders?
Date
Msg-id 20040911092255.GE22717@svana.org
Whole thread Raw
In response to Re: Speeding up LIKE with placeholders?  (Greg Stark <gsstark@mit.edu>)
Responses Re: Speeding up LIKE with placeholders?  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
On Sat, Sep 11, 2004 at 02:30:35AM -0400, Greg Stark wrote:
> I don't know. I wrote code that did "LIKE ?||'%'" on Oracle tons of times and
> it always used an index scan. I was really impressed when I first checked
> whether that worked and really happy when it did. And it always ran just fine.

Note, this would have worked fine in previous versions of postgresql,
because there was no such thing as prepared statements so the plan
needed to be recreated for each query, thus it could take advantage of
all knowledge available in the query itself.

Kinda ironic that a seemingly very nice feature (seperating query from
arguments) has such a side-effect (less information for planner).
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Best practices for migrating a development database to a release database
Next
From: Pierre-Frédéric Caillaud
Date:
Subject: Re: Speeding up LIKE with placeholders?