Thread: Logging seq scans

Logging seq scans

From
Guido Neitzer
Date:
Hi.

Is there a way to set up logging in a way that I can see queries
which trigger seq scans? Or to log queries "taking longer than xx ms"?

Background is, that it is nearly impossible to tell, which queries
are used in my applications as they are mostly generated by the
frameworks. Yesterday I found, that one of the more often used
queries has not used an existing index and I had to use another index
for it. Nobody complained about the performance but nevertheless the
query took about 1000ms and therefore slowed down the rest of the
server ...

cug

--
PharmaLine, Essen, GERMANY
Software and Database Development



Attachment

Re: Logging seq scans

From
"A. Kretschmer"
Date:
am  07.03.2006, um 11:59:18 +0100 mailte Guido Neitzer folgendes:
> Hi.
>
> Is there a way to set up logging in a way that I can see queries  which
> trigger seq scans? Or to log queries "taking longer than xx ms"?

Yes, of cource. You can define

log_min_duration_statement = 100

to log all queries taking longer 100 ms.


Btw.: visit our new PostgreSQL User Group Deutschland - Homepage:
http://pgug.de



HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

Re: Logging seq scans

From
Guido Neitzer
Date:
On 07.03.2006, at 12:11 Uhr, A. Kretschmer wrote:

> Yes, of cource. You can define
>
> log_min_duration_statement = 100
>
> to log all queries taking longer 100 ms.

Thanks.

cug

--
PharmaLine, Essen, GERMANY
Software and Database Development



Attachment

Re: Logging seq scans

From
Richard Huxton
Date:
Guido Neitzer wrote:
> Hi.
>
> Is there a way to set up logging in a way that I can see queries which
> trigger seq scans? Or to log queries "taking longer than xx ms"?

The second is straightforward. See the "log_min_duration_statement"
setting in the "logging" section of the manuals.

--
   Richard Huxton
   Archonet Ltd