pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: mahmoud alorfaly <mahmoud.alorfaly@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14889: explain analyze is taking much more time than actual execution
Date: Mon, 06 Nov 2017 09:43:38 -0500
Message-ID: <10068.1509979418@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKJS1f8ZmMFfr6MWzKAPo0GGLgT5Sbfo+GDcjKQguzcyzdDbDw@mail.gmail.com>
References: <20171106065021.1492.80384@wrigleys.postgresql.org>
	<CAKJS1f8WLoQsBPd46EZcBWB2w3=BZc3PJgmNCHewndOrzkuyaA@mail.gmail.com>
	<CALK5a+citfeN5=sprXybs-kOPV5uV_tfDHK5ErficgbF3wCtCQ@mail.gmail.com>
	<CAKJS1f8ZmMFfr6MWzKAPo0GGLgT5Sbfo+GDcjKQguzcyzdDbDw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

David Rowley <david.rowley@2ndquadrant.com> writes:
> On 6 November 2017 at 21:04, mahmoud alorfaly
> <mahmoud.alorfaly@gmail.com> wrote:
>> With EXPLAIN (ANALYZE, TIMING OFF), it is back to normal execution speed.

> Then it's just the TIMING overhead that's causing the slowdown. This
> will vary depending on how long gettimeofday() takes on your system.
> This is known to be an overhead which is one of the reasons the TIMING
> OFF option exists.

The size of the overhead in this case implies that gettimeofday() is doing
a kernel call, which I wouldn't really have expected on any modern Linux
kernel.  What hardware is this on?  Is there virtualization involved?

For context, on RHEL6 on run-of-the-mill server iron, I get overheads more
like this:

regression=# explain analyze select i from generate_series(1,10000000) i;
                                                           QUERY PLAN                                                            
---------------------------------------------------------------------------------------------------------------------------------
 Function Scan on generate_series i  (cost=0.00..10.00 rows=1000 width=4) (actual time=1711.319..3083.864 rows=10000000 loops=1)
 Planning time: 0.078 ms
 Execution time: 3636.962 ms
(3 rows)

regression=# explain (analyze, timing off) select i from generate_series(1,10000000) i;
                                               QUERY PLAN                                                
---------------------------------------------------------------------------------------------------------
 Function Scan on generate_series i  (cost=0.00..10.00 rows=1000 width=4) (actual rows=10000000 loops=1)
 Planning time: 0.077 ms
 Execution time: 2870.410 ms
(3 rows)

			regards, tom lane


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

Message-ID: <10068.1509979418@sss.pgh.pa.us>
Permalink:  ../10068.1509979418@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10068.1509979418@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, david.rowley@2ndquadrant.com, mahmoud.alorfaly@gmail.com
  Subject: Re: BUG #14889: explain analyze is taking much more time than actual execution
  In-Reply-To: <10068.1509979418@sss.pgh.pa.us>
  References: <20171106065021.1492.80384@wrigleys.postgresql.org> <CAKJS1f8WLoQsBPd46EZcBWB2w3=BZc3PJgmNCHewndOrzkuyaA@mail.gmail.com> <CALK5a+citfeN5=sprXybs-kOPV5uV_tfDHK5ErficgbF3wCtCQ@mail.gmail.com> <CAKJS1f8ZmMFfr6MWzKAPo0GGLgT5Sbfo+GDcjKQguzcyzdDbDw@mail.gmail.com> <10068.1509979418@sss.pgh.pa.us>

* 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