stats on cursor and query execution troubleshooting

Lists: pgsql-benchmarkspgsql-performance
From: "Alban Médici (NetCentrex)" <amedici(at)fr(dot)netcentrex(dot)net>
To: pgsql-benchmarks(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: stats on cursor and query execution troubleshooting
Date: 2004-10-06 10:15:31
Message-ID: 4163C5C3.3030304@fr.netcentrex.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-benchmarks pgsql-performance

Hi,

I'm looking for the statistic of memory, CPU, filesystem access while
executing some regular SQL query, and I want to compare them to
same kind of results while executing a cursor function.

The stat collector give me good results (sequencial scans , acceded
tuple .....) for regular query but nor for cursor (as explain in the
documentation)

For more results, i have activated some log level in the postgresql.conf :
show_query_stats = true

But I have some trouble in the results interpretation such as :

! system usage stats:

! 2.776053 elapsed 1.880000 user 0.520000 system sec

! [1.910000 user 0.540000 sys total]

! 0/0 [0/0] filesystem blocks in/out

! 5/1 [319/148] page faults/reclaims, 0 [0] swaps

! 0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent

! 0/0 [0/0] voluntary/involuntary context switches

! postgres usage stats:

! Shared blocks: 3877 read, 0 written, buffer hit rate = 0.00%

! Local blocks: 0 read, 0 written, buffer hit rate = 0.00%

! Direct blocks: 0 read, 0 written

Here is result done after fetching ALL a row with 178282 records in the
table.
looking at the i/o stat of linux I saw a filesystem access while
executing this request but not in the previous log !!!

! 0/0 [0/0] filesystem blocks in/out

I'm running postgresql 7.2.4 under redhat 7.2

Does am i wrong in my interpretation ?

Does any newest postgresql version could told me execution paln for a
fetch AND better stats ?

thx

Ps: please excuse my poor english

--
Alban Médici
R&D software engineer
------------------------------
you can contact me @ :
http://www.netcentrex.net
------------------------------


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Alban Médici (NetCentrex)" <amedici(at)fr(dot)netcentrex(dot)net>
Cc: pgsql-benchmarks(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] stats on cursor and query execution troubleshooting
Date: 2004-10-06 14:16:39
Message-ID: 25576.1097072199@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg스포츠 토토 사이트SQL Postg배트맨 토토SQL : Postg배트맨

=?ISO-8859-1?Q?=22Alban_M=E9dici_=28NetCentrex=29=22?= <amedici(at)fr(dot)netcentrex(dot)net> writes:
> I'm looking for the statistic of memory, CPU, filesystem access while=20
> executing some regular SQL query, and I want to compare them to
> same kind of results while executing a cursor function.

I think your second query is finding all the disk pages it needs in
kernel disk cache, because they were all read in by the first query.
This has little to do with cursor versus non cursor, and everything
to do with hitting recently-read data again.

regards, tom lane


From: "Alban Médici (NetCentrex)" <amedici(at)fr(dot)netcentrex(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-benchmarks(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] stats on cursor and query execution troubleshooting
Date: 2004-10-08 08:47:42
Message-ID: 4166542E.2020809@fr.netcentrex.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-benchmarks pgsql-performance

Thanks for your repply, but I still don"t understand why the statistic
logs :

! 0/0 [0/0] filesystem blocks in/out

it told me there is no hard disk access, I'm sure there is, I heard my
HDD, and see activity using gkrellm (even using my first query ; big
select *) ?

2004-10-08 10:40:05 DEBUG: query: select * from "LINE_Line";
2004-10-08 10:40:53 DEBUG: QUERY STATISTICS
! system usage stats:
! 48.480196 elapsed 42.010000 user 0.700000 system sec
! [42.030000 user 0.720000 sys total]
! 0/0 [0/0] filesystem blocks in/out
! 6/23 [294/145] page faults/reclaims, 0 [0] swaps
! 0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent
! 0/0 [0/0] voluntary/involuntary context switches
! postgres usage stats:
! Shared blocks: 3902 read, 0 written, buffer hit
rate = 11.78%
! Local blocks: 0 read, 0 written, buffer hit
rate = 0.00%
! Direct blocks: 0 read, 0 written

looking at the web some logs, I saw those fields filled (i/o filesystem)
Does my postgresql.conf missing an option or is therer a known bug of my
postgresql server 7.2.4 ?

thx
regards

Alban Médici

on 06/10/2004 16:16 Tom Lane said the following:

>=?ISO-8859-1?Q?=22Alban_M=E9dici_=28NetCentrex=29=22?= <amedici(at)fr(dot)netcentrex(dot)net> writes:
>
>
>>I'm looking for the statistic of memory, CPU, filesystem access while=20
>>executing some regular SQL query, and I want to compare them to
>>same kind of results while executing a cursor function.
>>
>>
>
>I think your second query is finding all the disk pages it needs in
>kernel disk cache, because they were all read in by the first query.
>This has little to do with cursor versus non cursor, and everything
>to do with hitting recently-read data again.
>
> regards, tom lane
>
>
>

--
Alban Médici
R&D software engineer
------------------------------
you can contact me @ :
http://www.netcentrex.net
------------------------------


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Alban Médici (NetCentrex)" <amedici(at)fr(dot)netcentrex(dot)net>
Cc: pgsql-benchmarks(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] stats on cursor and query execution troubleshooting
Date: 2004-10-08 13:55:56
Message-ID: 11894.1097243756@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-benchmarks pgsql-performance

=?ISO-8859-1?Q?=22Alban_M=E9dici_=28NetCentrex=29=22?= <amedici(at)fr(dot)netcentrex(dot)net> writes:
> Thanks for your repply, but I still don"t understand why the statistic
> logs :
> ! 0/0 [0/0] filesystem blocks in/out
> it told me there is no hard disk access, I'm sure there is,

Complain to your friendly local kernel hacker. We just report what
getrusage() tells us; so if the number is wrong then it's a kernel bug.

regards, tom lane


From: "Alban Médici (NetCentrex)" <amedici(at)fr(dot)netcentrex(dot)net>
To: pgsql-benchmarks(at)postgresql(dot)org
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] stats on cursor and query execution
Date: 2004-10-11 15:39:01
Message-ID: 416AA915.1000008@fr.netcentrex.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 사설 토토 사이트 : 사설 토토 pgsql-performance

Ok thanks tom, what shall we do without U ?

by the way I have look at my kernel and getrusage() is well configure
and return good results.
i/o stats too.

I test an other version of postgresql and now, it works fine.
It' seems to be an install bug.

thx
regards, Alban Médici

on 08/10/2004 15:55 Tom Lane said the following:

>=?ISO-8859-1?Q?=22Alban_M=E9dici_=28NetCentrex=29=22?= <amedici(at)fr(dot)netcentrex(dot)net> writes:
>
>
>>Thanks for your repply, but I still don"t understand why the statistic
>>logs :
>>! 0/0 [0/0] filesystem blocks in/out
>>it told me there is no hard disk access, I'm sure there is,
>>
>>
>
>Complain to your friendly local kernel hacker. We just report what
>getrusage() tells us; so if the number is wrong then it's a kernel bug.
>
> regards, tom lane
>
>
>

--
Alban Médici
R&D software engineer
------------------------------
you can contact me @ :
IPPhone : +33 (0)2 31 46 37 68
alban(dot)medici(at)fr(dot)netcentrex(dot)net
http://www.netcentrex.net
------------------------------