public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Novak Ivan <[email protected]>
Cc: [email protected] <[email protected]>
Cc: Kümin Antonio <[email protected]>
Subject: Re: Create temp table query hangs
Date: Tue, 13 Apr 2021 16:02:18 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
Novak Ivan <[email protected]> writes:
> * a query for creating temporary table on target schema is hanging forever and we are out of ideas why.
Looking at wait_event as well as wait_event_type in pg_stat_activity
might give some more clues.
> When we try to create a (temporary) table with one statement, and that query takes forever (even after >24h the query is still there). In the Postgres Database we see three identical active PIDs for the same query (with same starttimestamp). But we only sent the statement once to the DB. See screenshot below.
I think this is just a parallelized query with two worker processes.
Were the query's source tables freshly created or freshly populated?
If so, you might need to issue ANALYZE commands on them before you
start the query itself, to make sure the query planner has valid
statistics to work with. It's possible that the problem is just a
very dumb choice of query plan due to lack of stats.
Have you tried comparing EXPLAIN output for this query across the
scenarios where it works well and where it doesn't? If it is a
bad-plan problem then there'd be obvious differences in the shape
of the plan.
regards, tom lane
view thread (9+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Create temp table query hangs
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox