Re: EXPLAIN <query> command just hangs...

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Rhhh Lin <ruanlinehan(at)hotmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: EXPLAIN <query> command just hangs...
Date: 2017-11-02 21:49:41
Message-ID: 20171102214941.GB2267@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Nov 02, 2017 at 09:13:05PM +0000, Rhhh Lin wrote:
> Yes, it may be an issue with the index, but I'd like to have some evidence
> towards that before dropping and recreating (It does not appear that bloat is
> a problem here or dead tuples either).

Why do you say those aren't an issue? Just curious.

Have you vacuum or reindexed (or pg_repack) ?

How large are the table and index? \dt+ and \di+

> The reason I am very suspect of the timestamp column makeup is that if I
> remove that predicate from the EXPLAIN command and the actual query, both
> complete within seconds without issue. So I do know where the issue is (I
> just dont know what the issue is!).

It could be that you're hitting selfuncs.c:get_actual_variable_range() and the
extremes of the index point to many dead tuples (as I see Tom suggests).

You could strace the backend and see if it's reading (or writing??)
consecutively (hopefully with ample OS readahead) or randomly (without).

Justin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message tao tony 2017-11-03 01:43:32 checkpoint and recovering process use too much memory
Previous Message Tom Lane 2017-11-02 21:40:16 Re: EXPLAIN <query> command just hangs...