Thread: How to find the query completeion time?

How to find the query completeion time?

From
SHARMILA JOTHIRAJAH
Date:
Hi,
Is there a way in Postgres to find when a particular query will finish?

For example, for a query like this
SELECT * FROM TABLE1
Can we find out from any of the catalog tables(or any other way) when this query is likely to  complete?

Thanks





Re: How to find the query completeion time?

From
"Leif B. Kristensen"
Date:
On Thursday 2. April 2009, SHARMILA JOTHIRAJAH wrote:
>Hi,
>Is there a way in Postgres to find when a particular query will
> finish?
>
>For example, for a query like this
>SELECT * FROM TABLE1
>Can we find out from any of the catalog tables(or any other way) when
> this query is likely to  complete?
>
>Thanks

How about

EXPLAIN ANALYZE SELECT * FROM TABLE1

?

or just set \timing in the psql and run the query.
--
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database: http://solumslekt.org/blog/

Re: How to find the query completeion time?

From
SHARMILA JOTHIRAJAH
Date:


--- On Thu, 4/2/09, Leif B. Kristensen <leif@solumslekt.org> wrote:

> From: Leif B. Kristensen <leif@solumslekt.org>
> Subject: Re: [GENERAL] How to find the query completeion time?
> To: pgsql-general@postgresql.org
> Date: Thursday, April 2, 2009, 10:53 AM
> On Thursday 2. April 2009, SHARMILA
> JOTHIRAJAH wrote:
> >Hi,
> >Is there a way in Postgres to find when a particular
> query will
> > finish?
> >
> >For example, for a query like this
> >SELECT * FROM TABLE1
> >Can we find out from any of the catalog tables(or any
> other way) when
> > this query is likely to  complete?
> >
> >Thanks
>
> How about
>
> EXPLAIN ANALYZE SELECT * FROM TABLE1
>
> ?
>
> or just set \timing in the psql and run the query.
This will basically execute the query and return the time taken. Is there a way to know when an "already-started" query
willend? 

In ORACLE I can get that information from V$SESSION_LONGOPS view which will give the approx TIME_REMAINING to complete
runningqueries. Is there a similar way in postgres? 


> --
> Leif Biberg Kristensen | Registered Linux User #338009
> Me And My Database: http://solumslekt.org/blog/
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>




Re: How to find the query completeion time?

From
Craig Ringer
Date:
> In ORACLE I can get that information from V$SESSION_LONGOPS view which will give the approx TIME_REMAINING to
completerunning queries. Is there a similar way in postgres? 

As far as I know, PostgreSQL has no such facility, and the database
server has no idea how long a given query will take to run.

I'm not really sure how Oracle does that, given that the performance of
a long-running query will vary during its execution. Other queries will
begin and end, altering resource availability. Also, if your query runs
in several large parts, it can be hard to estimate how quickly parts you
haven't started executing yet will run.

--
Craig Ringer