Re: Query using cursors using 100% CPU

Поиск
Список
Период
Сортировка
От Glyn Astill
Тема Re: Query using cursors using 100% CPU
Дата
Msg-id 265615.89674.qm@web25812.mail.ukl.yahoo.com
обсуждение исходный текст
Ответ на Re: Query using cursors using 100% CPU  (Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>)
Ответы Re: Query using cursors using 100% CPU
Список pgsql-general
--- Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> wrote:

> Hi Glyn,
>
> In order to determine whether or not your driver is using cursors,
> the easiest
> way is to alter postgresql.conf so that individual SQL statements
> are
> recorded in the server log. You should then be able to see
> statements of the
> form DECLARE CURSOR foo FOR SELECT... if cursors are being used.
>

Thanks Mark,

I've turned this on and I never see a DECLARE CURSOR so I presume I
was wrong and it is not using cursors.

I do see a DEALLOCATE though, although no PREPARE.  Before this it
does lots of statements that are limited to 100 records, and all the
statements are named and preceded by execute, so I presume it is
using prepared statements getting little chunks of data and relying
on the first execute to prepare them?

> Looking at the differences in CPU usage, could it be that when you
> run your
> query in psql, you are running psql on the database server itself
> while your
> application is running on a separate server and sends its queries
> over the
> network? If so, the extra CPU usage may be involved with
> sending/receiving
> large datasets across the network.
>

Both tests were run over the network.



      __________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com



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

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: deadlock while re-indexing table
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: end of life for pg versions...