Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3OuN-0002YN-1o for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Jun 2015 13:22:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z3OuM-0002pN-Dt for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Jun 2015 13:22:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z3OuL-0002o7-DR for pgsql-bugs@postgresql.org; Fri, 12 Jun 2015 13:22:05 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Z3OuI-0007Oq-Ib for pgsql-bugs@postgresql.org; Fri, 12 Jun 2015 13:22:04 +0000 MIME-Version: 1.0 Subject: BUG #13437: Seq Scan increases heap_blks_read instead of heap_blks_hit when no disk is read To: pgsql-bugs@postgresql.org From: polpot78@gmail.com Date: Fri, 12 Jun 2015 13:21:33 +0000 Message-ID: <20150612132133.32368.65305@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.1 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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 < 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