Search Postgresql Archives

Re: Query using cursors using 100% CPU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxxxx> 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



---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux