Re: Performance problems with prepared statements

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Performance problems with prepared statements
Дата
Msg-id 470DE90E.2060605@archonet.com
обсуждение исходный текст
Ответ на Re: Performance problems with prepared statements  (Theo Kramer <theo@flame.co.za>)
Ответы Re: Performance problems with prepared statements  (Theo Kramer <theo@flame.co.za>)
Список pgsql-performance
Theo Kramer wrote:
> Thanks, had missed that, however, I am afraid that I fail to see how
> preparing a query using PQprepare() and then executing it using
> PQexecPrepared(), is 8 thousand times slower than directly executing
> it.,, ( 403386.583ms/50.0ms =  8067 ).
>
> When doing a 'manual' prepare and explain analyze I get the following

> rascal=# explain analyze execute cq ('124         ', 8, 366942);
>  Total runtime: 3.272 ms
>
> So I suspect that there is something more fundamental here...

OK, so there must be something different between the two scenarios. It
can only be one of:
   1. Query
   2. DB Environment (user, locale, settings)
   3. Network environment (server/client/network activity etc)

Are you sure you have the parameter types correct in your long-running
query?
Try setting log_min_duration_statement=9000 or so to capture
long-running queries.

Make sure the user and any custom settings are the same. Compare SHOW
ALL for both ways.

You've said elsewhere you've ruled out the network environment, so
there's not point worrying about that further.

--
   Richard Huxton
   Archonet Ltd

В списке pgsql-performance по дате отправления:

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: building a performance test suite
Следующее
От: Theo Kramer
Дата:
Сообщение: Re: Performance problems with prepared statements