pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to find if a SELECT is reading from buffer or disk ?
6+ messages / 4 participants
[nested] [flat]

* How to find if a SELECT is reading from buffer or disk ?
@ 2010-05-25 17:48 Balkrishna Sharma <b_ki@hotmail.com>
  2010-05-25 17:59 ` Re: How to find if a SELECT is reading from buffer or disk ? Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2010-05-25 18:22 ` Re: How to find if a SELECT is reading from buffer or disk ? Chirag Dave <cdave@ca.afilias.info>
  0 siblings, 2 replies; 6+ messages in thread

From: Balkrishna Sharma @ 2010-05-25 17:48 UTC (permalink / raw)
  To: pgsql-admin


Hi,
I am increasing the shared_buffer size in postgresql.conf and want to measure its effect on READ. In essence I want to know if the SELECT queries I am firing repeatedly is reading from the buffer or going directly to the disk.
I am expecting the first SELECT to go to disk and the subsequent call of the same SELECT to read from buffer .
Right now I am just looking at execution time of the SELECTs and trying to conclude. But there should be a direct way to see where the SELECT reads from.
How can I accomplish this ?
ThanksBala 		 	   		  
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL...

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to find if a SELECT is reading from buffer or disk ?
  2010-05-25 17:48 How to find if a SELECT is reading from buffer or disk ? Balkrishna Sharma <b_ki@hotmail.com>
@ 2010-05-25 17:59 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2010-05-25 18:01   ` Re: How to find if a SELECT is reading from buffer or	 disk ? Balkrishna Sharma <b_ki@hotmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Kevin Grittner @ 2010-05-25 17:59 UTC (permalink / raw)
  To: Balkrishna Sharma <b_ki@hotmail.com>; pgsql-admin

Balkrishna Sharma <b_ki@hotmail.com> wrote:
 
> I am increasing the shared_buffer size in postgresql.conf and want
> to measure its effect on READ. In essence I want to know if the
> SELECT queries I am firing repeatedly is reading from the buffer
> or going directly to the disk.
 
There's a third option -- PostgreSQL reads and writes will normally
go through the OS cache.
 
> Right now I am just looking at execution time of the SELECTs and
> trying to conclude. But there should be a direct way to see where
> the SELECT reads from.
> How can I accomplish this ?
 
You didn't mention your OS.  There's usually a way to monitor disk
I/O built in to the OS.  I usually start with:
 
vmstat 1
 
-Kevin



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to find if a SELECT is reading from buffer or	 disk ?
  2010-05-25 17:48 How to find if a SELECT is reading from buffer or disk ? Balkrishna Sharma <b_ki@hotmail.com>
  2010-05-25 17:59 ` Re: How to find if a SELECT is reading from buffer or disk ? Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2010-05-25 18:01   ` Balkrishna Sharma <b_ki@hotmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Balkrishna Sharma @ 2010-05-25 18:01 UTC (permalink / raw)
  To: kevin.grittner@wicourts.gov; pgsql-admin


I am on Fedora 12 (x86_64). Will eventually be on RHE.

> Date: Tue, 25 May 2010 12:59:16 -0500
> From: Kevin.Grittner@wicourts.gov
> To: b_ki@hotmail.com; pgsql-admin@postgresql.org
> Subject: Re: [ADMIN] How to find if a SELECT is reading from buffer or	 disk ?
> 
> Balkrishna Sharma <b_ki@hotmail.com> wrote:
>  
> > I am increasing the shared_buffer size in postgresql.conf and want
> > to measure its effect on READ. In essence I want to know if the
> > SELECT queries I am firing repeatedly is reading from the buffer
> > or going directly to the disk.
>  
> There's a third option -- PostgreSQL reads and writes will normally
> go through the OS cache.
>  
> > Right now I am just looking at execution time of the SELECTs and
> > trying to conclude. But there should be a direct way to see where
> > the SELECT reads from.
> > How can I accomplish this ?
>  
> You didn't mention your OS.  There's usually a way to monitor disk
> I/O built in to the OS.  I usually start with:
>  
> vmstat 1
>  
> -Kevin
> 
> -- 
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
 		 	   		  
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL...

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to find if a SELECT is reading from buffer or disk ?
  2010-05-25 17:48 How to find if a SELECT is reading from buffer or disk ? Balkrishna Sharma <b_ki@hotmail.com>
@ 2010-05-25 18:22 ` Chirag Dave <cdave@ca.afilias.info>
  2010-05-26 09:25   ` Re: How to find if a SELECT is reading from buffer or disk ? Cédric Villemain <cedric.villemain.debian@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Chirag Dave @ 2010-05-25 18:22 UTC (permalink / raw)
  To: Balkrishna Sharma <b_ki@hotmail.com>; +Cc: pgsql-admin

On Tue, May 25, 2010 at 1:48 PM, Balkrishna Sharma <b_ki@hotmail.com> wrote:

>  Hi,
>
> I am increasing the shared_buffer size in postgresql.conf and want to
> measure its effect on READ. In essence I want to know if the SELECT queries
> I am firing repeatedly is reading from the buffer or going directly to the
> disk.
>
> I am expecting the first SELECT to go to disk and the subsequent call of
> the same SELECT to read from buffer .
>
> Right now I am just looking at execution time of the SELECTs and trying to
> conclude. But there should be a direct way to see where the SELECT reads
> from.
>

You can also use pg_stat_database view. you can compute cache reads
percentage of the total number of reads (cache and physical) between the two
snapshots using  pg_stat_database.blks_hit  and pg_stat_database.blks_read.

Chirag Dave  416-673-4102
Database Administrator, Afilias Canada Corp.
cdave@ca.afilias.info





> How can I accomplish this ?
>
> Thanks
> Bala
>
> ------------------------------
> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
> Hotmail. Get busy.<http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL...;
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to find if a SELECT is reading from buffer or disk ?
  2010-05-25 17:48 How to find if a SELECT is reading from buffer or disk ? Balkrishna Sharma <b_ki@hotmail.com>
  2010-05-25 18:22 ` Re: How to find if a SELECT is reading from buffer or disk ? Chirag Dave <cdave@ca.afilias.info>
@ 2010-05-26 09:25   ` Cédric Villemain <cedric.villemain.debian@gmail.com>
  2010-05-26 14:16     ` Re: How to find if a SELECT is reading from buffer or disk ? Chirag Dave <cdave@ca.afilias.info>
  0 siblings, 1 reply; 6+ messages in thread

From: Cédric Villemain @ 2010-05-26 09:25 UTC (permalink / raw)
  To: chirag.dave@gmail.com; +Cc: Balkrishna Sharma <b_ki@hotmail.com>; pgsql-admin

2010/5/25 Chirag Dave <cdave@ca.afilias.info>:
>
>
> On Tue, May 25, 2010 at 1:48 PM, Balkrishna Sharma <b_ki@hotmail.com> wrote:
>>
>> Hi,
>> I am increasing the shared_buffer size in postgresql.conf and want to
>> measure its effect on READ. In essence I want to know if the SELECT queries
>> I am firing repeatedly is reading from the buffer or going directly to the
>> disk.
>> I am expecting the first SELECT to go to disk and the subsequent call of
>> the same SELECT to read from buffer .
>> Right now I am just looking at execution time of the SELECTs and trying to
>> conclude. But there should be a direct way to see where the SELECT reads
>> from.
>
> You can also use pg_stat_database view. you can compute cache reads
> percentage of the total number of reads (cache and physical) between the two
> snapshots using  pg_stat_database.blks_hit  and pg_stat_database.blks_read.

views does not reflect this exact behavior : hit and read are relative
to hit shared buffers and request a block (from OS page cache or from
disk).


>
> Chirag Dave  416-673-4102
> Database Administrator, Afilias Canada Corp.
> cdave@ca.afilias.info
>
>
>>
>> How can I accomplish this ?
>> Thanks
>> Bala
>> ________________________________
>> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
>> Hotmail. Get busy.
>



-- 
Cédric Villemain               2ndQuadrant
http://2ndQuadrant.fr/     PostgreSQL : Expertise, Formation et Support



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to find if a SELECT is reading from buffer or disk ?
  2010-05-25 17:48 How to find if a SELECT is reading from buffer or disk ? Balkrishna Sharma <b_ki@hotmail.com>
  2010-05-25 18:22 ` Re: How to find if a SELECT is reading from buffer or disk ? Chirag Dave <cdave@ca.afilias.info>
  2010-05-26 09:25   ` Re: How to find if a SELECT is reading from buffer or disk ? Cédric Villemain <cedric.villemain.debian@gmail.com>
@ 2010-05-26 14:16     ` Chirag Dave <cdave@ca.afilias.info>
  0 siblings, 0 replies; 6+ messages in thread

From: Chirag Dave @ 2010-05-26 14:16 UTC (permalink / raw)
  To: Cédric Villemain <cedric.villemain.debian@gmail.com>; +Cc: Balkrishna Sharma <b_ki@hotmail.com>; pgsql-admin

On Wed, May 26, 2010 at 5:25 AM, Cédric Villemain <
cedric.villemain.debian@gmail.com> wrote:

> 2010/5/25 Chirag Dave <cdave@ca.afilias.info>:
> >
> >
> > On Tue, May 25, 2010 at 1:48 PM, Balkrishna Sharma <b_ki@hotmail.com>
> wrote:
> >>
> >> Hi,
> >> I am increasing the shared_buffer size in postgresql.conf and want to
> >> measure its effect on READ. In essence I want to know if the SELECT
> queries
> >> I am firing repeatedly is reading from the buffer or going directly to
> the
> >> disk.
> >> I am expecting the first SELECT to go to disk and the subsequent call of
> >> the same SELECT to read from buffer .
> >> Right now I am just looking at execution time of the SELECTs and trying
> to
> >> conclude. But there should be a direct way to see where the SELECT reads
> >> from.
> >
> > You can also use pg_stat_database view. you can compute cache reads
> > percentage of the total number of reads (cache and physical) between the
> two
> > snapshots using  pg_stat_database.blks_hit  and
> pg_stat_database.blks_read.
>
> views does not reflect this exact behavior : hit and read are relative
> to hit shared buffers and request a block (from OS page cache or from
> disk).
>
>
Correct, thats where pgFincore will be usefull.

>
> >
> > Chirag Dave  416-673-4102
> > Database Administrator, Afilias Canada Corp.
> > cdave@ca.afilias.info
> >
> >
> >>
> >> How can I accomplish this ?
> >> Thanks
> >> Bala
> >> ________________________________
> >> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars
> with
> >> Hotmail. Get busy.
> >
>
>
>
> --
> Cédric Villemain               2ndQuadrant
> http://2ndQuadrant.fr/     PostgreSQL : Expertise, Formation et Support
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2010-05-26 14:16 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-05-25 17:48 How to find if a SELECT is reading from buffer or disk ? Balkrishna Sharma <b_ki@hotmail.com>
2010-05-25 17:59 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2010-05-25 18:01   ` Re: How to find if a SELECT is reading from buffer or	 disk ? Balkrishna Sharma <b_ki@hotmail.com>
2010-05-25 18:22 ` Chirag Dave <cdave@ca.afilias.info>
2010-05-26 09:25   ` Cédric Villemain <cedric.villemain.debian@gmail.com>
2010-05-26 14:16     ` Chirag Dave <cdave@ca.afilias.info>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox