Re: Buffer usage in EXPLAIN and pg_stat_statements (review)

From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Euler Taveira de Oliveira <euler(at)timbira(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Buffer usage in EXPLAIN and pg_stat_statements (review)
Date: 2009-10-05 05:24:14
Message-ID: 20091005132716.9CE7.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here is an update version of buffer usage patch.
* All buffers_* and bufs_* are renamed to blks_*.
* 'disc' => 'disk' in documentation
* Replace debug-log to Assert().
* Fix a bug in ResetLocalBufferUsage(). log_xxx_stats had not worked.

Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> > ?* Can I use "temp" instead of "Temp Read" to shorten the name?
> I can't tell what that means without reading the source code. I think
> clarity should take precedence over brevity.

I used temp_blks_read because we have idx_blks_read in pg_statio_xxx.

=# \d pg_stat_statements
View "public.pg_stat_statements"
Column | Type | Modifiers
----------------+------------------+-----------
userid | oid |
dbid | oid |
query | text |
calls | bigint |
total_time | double precision |
rows | bigint |
blks_hit | bigint |
blks_read | bigint |
temp_blks_read | bigint |

=# SET work_mem = '1MB';
=# EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM pgbench_accounts ORDER BY bid;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Sort (cost=21913.32..22163.33 rows=100005 width=97) (actual time=81.345..99.054 rows=100000 loops=1)
Sort Key: bid
Sort Method: external sort Disk: 10472kB
Blocks Hit: 0 Read: 0 Temp Read: 1309
-> Seq Scan on pgbench_accounts (cost=0.00..2667.05 rows=100005 width=97) (actual time=0.018..23.129 rows=100000 loops=1)
Blocks Hit: 74 Read: 1694 Temp Read: 0
Total runtime: 105.238 ms
(7 rows)

=# SET work_mem = '18MB';
=# EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM pgbench_accounts ORDER BY bid;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Sort (cost=10972.32..11222.33 rows=100005 width=97) (actual time=35.437..43.069 rows=100000 loops=1)
Sort Key: bid
Sort Method: quicksort Memory: 17916kB
Blocks Hit: 0 Read: 0 Temp Read: 0
-> Seq Scan on pgbench_accounts (cost=0.00..2667.05 rows=100005 width=97) (actual time=0.028..15.030 rows=100000 loops=1)
Blocks Hit: 32 Read: 1635 Temp Read: 0
Total runtime: 52.026 ms
(7 rows)

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
buffer_usage_20091005.patch application/octet-stream 22.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2009-10-05 06:05:01 Re: Making hash indexes worthwhile
Previous Message Robert Haas 2009-10-05 03:36:20 Re: Buffer usage in EXPLAIN and pg_stat_statements (review)