Re: Speeding up LIKE with placeholders?

From: Dan Sugalski <dan(at)sidhe(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Speeding up LIKE with placeholders?
Date: 2004-09-10 22:55:43
Message-ID: a06110409bd67e0bc1e23@[172.24.10.164]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At 6:33 PM -0400 9/10/04, Tom Lane wrote:
>Dan Sugalski <dan(at)sidhe(dot)org> writes:
>> Since the only difference in this case is that the parameters are
>> pulled out for transport rather than being in band (a
>> properly-escaped string substitution could turn this case from a
>> PQexecParams call into a PQexec call) I was thinking the thing to do
>> would be to either teach the planner to look in the parameter list
>> when it gets handed $xxx variables, or have the back-end do the
>> substitution to the SQL before handing the code to the planner.
>
>This has already been considered and rejected. Oliver Jowett did the
>part that is safe, which is to use the parameter values for estimation
>purposes in other contexts, but pre-substituting a parameter value for
>LIKE calls the mere correctness of the plan into question.

Ouch. Okay, fair 'nuff. (I figured the parameters could be factored
in before the plan was made. Wrongly, I see, now that I poke around
in the code a bit :) Plan B for me it is.

>What it would take to make it workable is a change in the semantics of
>the v3 protocol messages, such that there is no re-use of a plan. That,
>no one is up for quite yet, when we just hacked the protocol last year ...

It might be possible with a backwards-compatible protocol change, but
that's more work than I'm up for, and this is the wrong list for it
anyway.
--
Dan

--------------------------------------it's like this-------------------
Dan Sugalski even samurai
dan(at)sidhe(dot)org have teddy bears and even
teddy bears get drunk

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2004-09-10 23:57:22 Re: 8.0.0beta2: gcc: unrecognized option `-pthreads'
Previous Message Tom Lane 2004-09-10 22:33:21 Re: Speeding up LIKE with placeholders?