Re: [External] RE: Estimate time without running the query

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Neto pr <netoprbr9(at)gmail(dot)com>, david(dot)g(dot)johnston(at)gmail(dot)com
Cc: vjain(at)opentable(dot)com, johnescm(at)hotmail(dot)com, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: [External] RE: Estimate time without running the query
Date: 2018-09-14 13:53:42
Message-ID: 1ddc4fab-c89c-4c4e-c252-8f1179d51dcc@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/13/18 4:55 PM, Neto pr wrote:
>
>
> Em qui, 13 de set de 2018 às 19:53, David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com <mailto:david(dot)g(dot)johnston(at)gmail(dot)com>> escreveu:
>
> On Thu, Sep 13, 2018 at 3:30 PM, Neto pr <netoprbr9(at)gmail(dot)com
> <mailto:netoprbr9(at)gmail(dot)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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Juan Manuel Cuello 2018-09-14 13:56:44 Re: Slow shutdowns sometimes on RDS Postgres
Previous Message Adrian Klaver 2018-09-14 13:41:58 Re: Code of Conduct plan