I've posted this as a suggestion to the HACKERS list. I'd love to make a
patch but just don't have the time right now to sort through the code.
cheers
jim
Bruce Bantos wrote:
>
> > I've been shuffling thru the 'LIKE' code in pg, but whilst perusing, it
> > occurred to me that I could use a function for this thing. Since i'm
> > only looking at the first part of the string I use...
> >
> > SELECT * FROM info WHERE substring(street_name from 1 to 4) = 'MAIN'
> >
> > ...and the query completes in under 2 secs. Stupidly obvious now but I
> > thought I would share this blinding insight with the list ;)
>
> It was not so obvious to me. I was struggling with the same thing. This is a
> good workaround for the case of "searchstring%". I wonder if the LIKE code
> could be enhanced to perform the query in the same way.
>
--
If everything is coming your way then you're in the wrong lane.