Re: Query sometimes takes down server - Mailing list pgsql-general

From Jeff Davis
Subject Re: Query sometimes takes down server
Date
Msg-id 1232068337.32625.164.camel@dell.linuxdev.us.dell.com
Whole thread Raw
In response to Query sometimes takes down server  (Jason Long <mailing.list@supernovasoftware.com>)
List pgsql-general
On Thu, 2009-01-15 at 18:44 -0600, Jason Long wrote:
> The query that hangs the system is requesting a count(*)
> based on some parameters the users selects.

Can you show an example of the full offending query? How big is the
table?

> And maybe 1 in 20 will not complete.

If you really have nothing else running on the server, the queries
should complete.

> I have not looked into the detail of the explain, and I do see visually
> that very different plans are being chosen.

It would help to share these plans with us...

Run it several times using EXPLAIN ANALYZE, and send the output of one
that completes quickly, one that takes a while, and preferably wait for
a long-running one to finish. For those that you can't wait for, show
plain EXPLAIN output.

> How can I see the plan that was chosen when the time it very high?
> Is there a way to print the query plan chosen when the query times out
> as well?
>

There's a new module coming in 8.4 that makes this much easier. Right
now, you have to run it yourself with EXPLAIN ANALYZE as above.

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: Jason Long
Date:
Subject: Query sometimes takes down server
Next
From: Ivan Sergio Borgonovo
Date:
Subject: HTML email (was: Re: Vacuum and Reindex hangs)