-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

> is calling pg_result() necessary, when using code like this?
...
> And I'd like to use PG_OLDQUERY_WAIT
> for all queries which don't return (or so I think)
> results - INSERTs and stored procedure calls.

You need to have *some* way of handling the possibly still-running 
async queries. If you are not calling something with async flags 
(and either PG_OLDQUERY_WAIT or PG_OLDQUERY_CANCEL), then you will 
need to call pg_result().

> Despite very performant HW (quad cpu, 32 GB RAM),
> the users are complaining about occasional
> server freezes (I see data being written to
> postmaster processes at these moments) and
> I'm trying to speed it up by using the above code.

Using async allows control to return to your program while 
the query runs "in the background", but you are still limited 
in that you cannot issue another database query until the previous 
one has finished. This is per-session, of course, you are always 
free to open N connections to the DB and have N queries running 
at the same time, of course.

You might want to look at the synchronous_commit setting, for 
faster responses from the database (with an increased risk). 
You might also want to look into using pg_bouncer, especially 
if your queries are all realtively simple (which means you can 
use the very fast statement mode - or if not, at least transaction 
mode).

It's hard to say from this email exactly what might be the cause 
of the slowdowns, so take the above with a grain of salt as far 
as solving the problem at hand.

- -- 
Greg Sabino Mullane [email protected]
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201302101644
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAlEYFOcACgkQvJuQZxSWSshfLACggHcAJj0vAFprGsXmJeJCZQOs
crYAoNmTh/wRoaKjgcZWEC7m65l8aq38
=w9F+
-----END PGP SIGNATURE-----


Reply via email to