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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Neto pr <netoprbr9(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-13 22:53:15
Message-ID: CAKFQuwYsH5qU+fB6dQP_d7QXhZ7jvnkE3qrJmir+nicj9U_mVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 13, 2018 at 3:30 PM, Neto pr <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.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-09-13 22:55:47 Re: Behaviour when autovacuum is canceled
Previous Message Martín Fernández 2018-09-13 22:45:51 Behaviour when autovacuum is canceled