Re: This query is still running after 10 hours... - Mailing list pgsql-performance

From Tom Lane
Subject Re: This query is still running after 10 hours...
Date
Msg-id 14842.1096383863@sss.pgh.pa.us
Whole thread Raw
In response to This query is still running after 10 hours...  (Robert Creager <Robert_Creager@LogicalChaos.org>)
Responses Re: This query is still running after 10 hours...
List pgsql-performance
Robert Creager <Robert_Creager@LogicalChaos.org> writes:
> Normally, this query takes from 5 minutes to 2 hours to run.  On this update, it's been running for more than 10
hours.

> ...
>         ->  Nested Loop  (cost=250.69..129094.19 rows=77211 width=59)
>               ->  Hash Join  (cost=250.69..307.34 rows=67 width=12)
>                     Hash Cond: ("outer".pair_id = "inner".pair_id)
> ...

It chose a nested loop here because it was only expecting 67 rows out of
the next-lower join, and so it thought it would only need 67 repetitions
of the index probe into obs_v_file_id_index.  I'm suspicious that that
estimate was way low and so the nestloop is taking forever.  You might
try "SET enable_nestloop = off" as a crude way of avoiding that trap.

            regards, tom lane

pgsql-performance by date:

Previous
From: "Aaron Werman"
Date:
Subject: Re: Caching of Queries
Next
From: Gaetano Mendola
Date:
Subject: Re: This query is still running after 10 hours...