Re: How to boost performance of ilike queries ?

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Russell Smith" <mr-russ(at)pws(dot)com(dot)au>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: How to boost performance of ilike queries ?
Date: 2005-01-24 14:01:49
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB3412A75D2@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Russell wrote:
> I am not sure what the effect of it being prepared will be, however
I've
> had much success
> with the method above without the queries being prepared. Others may
be
> able to offer advice
> about if prepare will effect it.
>
There are two general cases I tend to use prepared queries. First case
is when there is an extremely complex plan generation step that you want
to skip. IMO, this is fairly rare in the normal course of doing things.

Second case is when you have a relatively simple query that gets
executed very, very frequently, such as select a,b,c from t where k.
Even though the query plan is simple, using a prepared query can shave
5-15% off your query time depending on various factors (on a low latency
network). If you fire off the statement a lot, this adds up. Not
generally worthwhile to go this route if you are executing over a high
latency network like the internet.

If your application behavior can benefit from the second case, it can
probably benefit from using parse/bind as well...use ExecPrepared, etc.
libpq interface functions.

The cumulative savings of using ExecPrepared() vs. using vanilla
PQExec() (for simple queries over a high latency network) can be 50% or
better. This is both from client's perspective and in server CPU load
(especially when data is read from cache). This is most interesting to
driver and middleware writers who broker data exchange between the
application and the data. The performance minded application developer
(who can make calls to the connection object) can take advantage of this
however.

Merlin

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Antony Paul 2005-01-24 14:14:36 Re: How to boost performance of ilike queries ?
Previous Message Chris Mair 2005-01-24 10:38:47 Re: poor performance of db?