pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Neto pr <netoprbr9@gmail.com>
To: david.g.johnston@gmail.com
Cc: vjain@opentable.com
Cc: johnescm@hotmail.com
Cc: PostgreSQL General <pgsql-general@postgresql.org>
Subject: Re: [External] RE: Estimate time without running the query
Date: Fri, 14 Sep 2018 06:53:42 -0700
Message-ID: <1ddc4fab-c89c-4c4e-c252-8f1179d51dcc@aklaver.com> (raw)
In-Reply-To: <CA+TZvY+0E9jCGo0NuMykBQozwBSYNoZb6Pp5efed5vkKJvStSw@mail.gmail.com>
References: <CA+TZvYKvxW2UzjTA7D2B9n_cZYpEAC5OAL_A+XUFkH-5c9jwaQ@mail.gmail.com>
	<RO1P15201MB242633BE2EA7493007BBCFD1D41A0@RO1P15201MB2426.LAMP152.PROD.OUTLOOK.COM>
	<9777232F-131E-46BF-AF0C-3B2242A99645@opentable.com>
	<CA+TZvYLqe6bEUxkzeQb3Sr=wkjWsvLoSuo5z2spTKkSBfbaZ-g@mail.gmail.com>
	<CAKFQuwYsH5qU+fB6dQP_d7QXhZ7jvnkE3qrJmir+nicj9U_mVg@mail.gmail.com>
	<CA+TZvY+0E9jCGo0NuMykBQozwBSYNoZb6Pp5efed5vkKJvStSw@mail.gmail.com>

On 9/13/18 4:55 PM, Neto pr wrote:
> 
> 
> Em qui, 13 de set de 2018 às 19:53, David G. Johnston 
> <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>> escreveu:
> 
>     On Thu, Sep 13, 2018 at 3:30 PM, Neto pr <netoprbr9@gmail.com
>     <mailto:netoprbr9@gmail.com>>wrote:
> 
>         The problem is that using the explain analyze <query> I have to
>         wait for the query to execute.
>         I would like to estimate the time without having to wait for the
>         query execution.
>         Does anyone know how to estimate the time without waiting for
>         the query to be executed?
> 
> 
>     On the machine in question you have to experiment to obtain data to
>     construct a formula to convert cost to time.  Then when using the
>     function remember that lots of things can play into individual
>     executions taking more time (and sometimes less too I suspect) such
>     as locks, caching, physical data locality.
> 
>     It seems more useful to log actual execution times and look for
>     trends.  If you are writing a query odds are it needs to be run
>     regardless of how efficient it may be - or used in a relative
>     comparison to an alternate query.
> 
> 
> Okay, David, but does not it have some SQL statement that returns a time 
> estimate, without having to execute the query?

To get close to a true time you need to run the actual query. An analogy 
based on running 10K under the following conditions:

1) Cool day, flat course.

2) Hot day, up a 10% grade.

You can reasonably predict that 1) will yield a faster time then 2), 
however you will not know the actual times until you run them.

> 
>     David J.
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (7+ messages)

Message-ID: <1ddc4fab-c89c-4c4e-c252-8f1179d51dcc@aklaver.com>
Permalink:  ../1ddc4fab-c89c-4c4e-c252-8f1179d51dcc@aklaver.com/
Also on:    postgresql.org/message-id/1ddc4fab-c89c-4c4e-c252-8f1179d51dcc@aklaver.com

 · 

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-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, netoprbr9@gmail.com, david.g.johnston@gmail.com, vjain@opentable.com, johnescm@hotmail.com
  Subject: Re: [External] RE: Estimate time without running the query
  In-Reply-To: <1ddc4fab-c89c-4c4e-c252-8f1179d51dcc@aklaver.com>
  References: <CA+TZvYKvxW2UzjTA7D2B9n_cZYpEAC5OAL_A+XUFkH-5c9jwaQ@mail.gmail.com> <RO1P15201MB242633BE2EA7493007BBCFD1D41A0@RO1P15201MB2426.LAMP152.PROD.OUTLOOK.COM> <9777232F-131E-46BF-AF0C-3B2242A99645@opentable.com> <CA+TZvYLqe6bEUxkzeQb3Sr=wkjWsvLoSuo5z2spTKkSBfbaZ-g@mail.gmail.com> <CAKFQuwYsH5qU+fB6dQP_d7QXhZ7jvnkE3qrJmir+nicj9U_mVg@mail.gmail.com> <CA+TZvY+0E9jCGo0NuMykBQozwBSYNoZb6Pp5efed5vkKJvStSw@mail.gmail.com> <1ddc4fab-c89c-4c4e-c252-8f1179d51dcc@aklaver.com>

* 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