Re: Query using cursors using 100% CPU - Mailing list pgsql-general

From Glyn Astill
Subject Re: Query using cursors using 100% CPU
Date
Msg-id 265615.89674.qm@web25812.mail.ukl.yahoo.com
Whole thread Raw
In response to Re: Query using cursors using 100% CPU  (Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>)
Responses Re: Query using cursors using 100% CPU
List 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 by date:

Previous
From: Gregory Stark
Date:
Subject: Re: deadlock while re-indexing table
Next
From: Andrew Sullivan
Date:
Subject: Re: end of life for pg versions...