pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: katsumata.tomonari@po.ntts.co.jp
To: pgsql-bugs@postgresql.org
Subject: BUG #10404: auto_explain for EXPLAIN ANLYZE.
Date: Tue, 20 May 2014 07:42:09 +0000
Message-ID: <20140520074209.20346.37609@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:      10404
Logged by:          Tomonari Katsumata
Email address:      katsumata.tomonari@po.ntts.co.jp
PostgreSQL version: 9.3.4
Operating system:   CentOS 6.4 x86_64
Description:        

Hi,

I'm testing auto_explain.
And I noticed that auto_explain has a strange behavior.

The settings for auto_explain are like below.

-------------------------------
testdb=# select name, setting from pg_settings where name like
'%auto_explain%';
                name                | setting 
------------------------------------+---------
 auto_explain.log_analyze           | on
 auto_explain.log_buffers           | on
 auto_explain.log_format            | text
 auto_explain.log_min_duration      | 0
 auto_explain.log_nested_statements | off
 auto_explain.log_timing            | on
 auto_explain.log_verbose           | on
(7 rows)
-------------------------------

And then, I tested five cases.

-------------------------------
a.EXPLAIN ONLY
b.EXPLAIN ANALYZE
c.EXPLAIN ANALYZE BUFFERS
d.EXPLAIN ANALYZE BUFFERS-OFF
e.EXPLAIN ANALYZE TIMING
f.EXPLAIN ANALYZE TIMING-OFF
-------------------------------

The results of a to e are good, but the result of f is not good.
I thought "actual time" would be omitted from the result of EXPLAIN,
but it is there.
Is this an intentional thing? or bug?


The test results are below.

===============
a.EXPLAIN ONLY
===============
testdb=# explain select * from hoge where i = 3;
                      QUERY PLAN                      
------------------------------------------------------
 Seq Scan on hoge  (cost=0.00..40.00 rows=12 width=4)
   Filter: (i = 3)
(2 rows)

****************************************************************
LOG:  duration: 0.000 ms  plan:
	Query Text: explain select * from hoge where i = 3;
	Seq Scan on public.hoge  (cost=0.00..40.00 rows=12 width=4)
	  Output: i
	  Filter: (hoge.i = 3)
****************************************************************


=================
b.EXPLAIN ANALYZE
=================
testdb=# explain analyze select * from hoge where i = 3;
                                            QUERY PLAN                      
                     
--------------------------------------------------------------------------------------------------
 Seq Scan on hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=23.484..23.484 rows=0 loops=1)
   Filter: (i = 3)
   Rows Removed by Filter: 1
 Total runtime: 25.275 ms
(4 rows)

****************************************************************
LOG:  duration: 23.488 ms  plan:
	Query Text: explain analyze select * from hoge where i = 3;
	Seq Scan on public.hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=23.484..23.484 rows=0 loops=1)
	  Output: i
	  Filter: (hoge.i = 3)
	  Rows Removed by Filter: 1
	  Buffers: shared hit=1
****************************************************************


=========================
c.EXPLAIN ANALYZE BUFFERS
=========================
testdb=# explain (analyze, buffers) select * from hoge where i = 3;
                                           QUERY PLAN                       
                   
------------------------------------------------------------------------------------------------
 Seq Scan on hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=0.152..0.152 rows=0 loops=1)
   Filter: (i = 3)
   Rows Removed by Filter: 1
   Buffers: shared hit=1
 Total runtime: 0.326 ms
(5 rows)

****************************************************************
LOG:  duration: 0.155 ms  plan:
	Query Text: explain (analyze, buffers) select * from hoge where i = 3;
	Seq Scan on public.hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=0.152..0.152 rows=0 loops=1)
	  Output: i
	  Filter: (hoge.i = 3)
	  Rows Removed by Filter: 1
	  Buffers: shared hit=1
****************************************************************


=============================
d.EXPLAIN ANALYZE BUFFERS-OFF
=============================
testdb=# explain (analyze, buffers off) select * from hoge where i = 3;
                                           QUERY PLAN                       
                   
------------------------------------------------------------------------------------------------
 Seq Scan on hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=0.024..0.024 rows=0 loops=1)
   Filter: (i = 3)
   Rows Removed by Filter: 1
 Total runtime: 1.407 ms
(4 rows)

****************************************************************
LOG:  duration: 0.026 ms  plan:
	Query Text: explain (analyze, buffers off) select * from hoge where i = 3;
	Seq Scan on public.hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=0.024..0.024 rows=0 loops=1)
	  Output: i
	  Filter: (hoge.i = 3)
	  Rows Removed by Filter: 1
	  Buffers: shared hit=1
****************************************************************


========================
e.EXPLAIN ANALYZE TIMING
========================
testdb=# explain (analyze, timing) select * from hoge where i = 3;
                                           QUERY PLAN                       
                   
------------------------------------------------------------------------------------------------
 Seq Scan on hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=0.024..0.024 rows=0 loops=1)
   Filter: (i = 3)
   Rows Removed by Filter: 1
 Total runtime: 0.207 ms
(4 rows)

****************************************************************
LOG:  duration: 0.026 ms  plan:
	Query Text: explain (analyze, timing) select * from hoge where i = 3;
	Seq Scan on public.hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=0.024..0.024 rows=0 loops=1)
	  Output: i
	  Filter: (hoge.i = 3)
	  Rows Removed by Filter: 1
	  Buffers: shared hit=1
****************************************************************


============================
f.EXPLAIN ANALYZE TIMING-OFF
============================
testdb=# explain (analyze, timing off) select * from hoge where i = 3;
                                           QUERY PLAN                       
                   
------------------------------------------------------------------------------------------------
 Seq Scan on hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=0.023..0.023 rows=0 loops=1)
   Filter: (i = 3)
   Rows Removed by Filter: 1
 Total runtime: 0.194 ms
(4 rows)

****************************************************************
LOG:  duration: 0.026 ms  plan:
	Query Text: explain (analyze, timing off) select * from hoge where i = 3;
	Seq Scan on public.hoge  (cost=0.00..40.00 rows=12 width=4) (actual
time=0.023..0.023 rows=0 loops=1)
	  Output: i
	  Filter: (hoge.i = 3)
	  Rows Removed by Filter: 1
	  Buffers: shared hit=1
****************************************************************


regards,
----------------------
Tomonari Katsumata



-- 
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 (4+ messages)  latest in thread

Message-ID: <20140520074209.20346.37609@wrigleys.postgresql.org>
Permalink:  ../20140520074209.20346.37609@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20140520074209.20346.37609@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: katsumata.tomonari@po.ntts.co.jp
  Subject: Re: BUG #10404: auto_explain for EXPLAIN ANLYZE.
  In-Reply-To: <20140520074209.20346.37609@wrigleys.postgresql.org>
  References: <20140520074209.20346.37609@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