pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: polpot78@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13437: Seq Scan increases heap_blks_read instead of heap_blks_hit when no disk is read
Date: Fri, 12 Jun 2015 13:21:33 +0000
Message-ID: <20150612132133.32368.65305@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      13437
Logged by:          Kjetil Nygård
Email address:      polpot78@gmail.com
PostgreSQL version: 9.4.3
Operating system:   CentOS 6.6
Description:        

When a seq scan is performed, but no real disk reads is performed, then
postgreSQL still reports that disk-reads are performed. iostat reports that
no Blocks are read.

TEST
Machine: 1gb memory (Only PostgreSQL)
Table size: 200mb

TEST TABLES
drop table test;
create table test as (select generate_series(1, 5000000) as id );
alter table test add column tekst varchar(255);
update test set tekst = 'teksten ' || id;
alter table test add constraint pk_test primary key (id);


TEST FROM BASH:
iostat -md /dev/vda
sudo -u postgres psql response <<EOF
select pg_stat_reset();select relname, round (100.0*heap_blks_hit / (0.0
+heap_blks_hit + heap_blks_read), 2)||'%', heap_blks_read, heap_blks_hit
from pg_statio_user_tables where (heap_blks_hit + heap_blks_read) > 0;
select sum(length(tekst)) from test;
select relname, round (100.0*heap_blks_hit / (0.0 +heap_blks_hit +
heap_blks_read), 2)||'%', heap_blks_read, heap_blks_hit from
pg_statio_user_tables where (heap_blks_hit + heap_blks_read) > 0;
EOF
iostat -md /dev/vda


OUTPUT FROM TEST:
### iostat -md
Linux 2.6.32-504.16.2.el6.x86_64 (cu-kny-nrpe1.eiendomsinfo.no) 	12. juni
2015 	_x86_64_	(1 CPU)

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
vda              36,09         1,78         2,42      10364      14094

### Reset pg_Stats
 pg_stat_reset 
---------------
 
(1 row)

### Empty pg_statio_user_tables
 relname | ?column? | heap_blks_read | heap_blks_hit 
---------+----------+----------------+---------------
(0 rows)

### Query output
   sum    
----------
 58888896
(1 row)

### Bad stats!
 relname | ?column? | heap_blks_read | heap_blks_hit 
---------+----------+----------------+---------------
 test    | 63.01%   |           9423 |         16054
(1 row)

### Final iostat, shows no data read
Linux 2.6.32-504.16.2.el6.x86_64 (cu-kny-nrpe1.eiendomsinfo.no) 	12. juni
2015 	_x86_64_	(1 CPU)

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
vda              36,04         1,78         2,42      10364      14094




-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)  latest in thread

Message-ID: <20150612132133.32368.65305@wrigleys.postgresql.org>
Permalink:  ../20150612132133.32368.65305@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20150612132133.32368.65305@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: polpot78@gmail.com
  Subject: Re: BUG #13437: Seq Scan increases heap_blks_read instead of heap_blks_hit when no disk is read
  In-Reply-To: <20150612132133.32368.65305@wrigleys.postgresql.org>
  References: <20150612132133.32368.65305@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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