Re: huge discrepancy between EXPLAIN cost and actual time (but the table has just been ANALYZED)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kent Tong <kent(dot)tong(dot)mo(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: huge discrepancy between EXPLAIN cost and actual time (but the table has just been ANALYZED)
Date: 2023-05-08 13:44:18
Message-ID: 338272.1683553458@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kent Tong <kent(dot)tong(dot)mo(at)gmail(dot)com> writes:
> I have a complex query involving over 15 joins and a CTE query and it takes
> over 17s to complete.

If you want constructive comments about that, you're going to need to show
us the whole thing (and the underlying tables' schemas). Little bits in
isolation are not very intelligible.

https://wiki.postgresql.org/wiki/Slow_Query_Questions

One thought is that you might need to raise from_collapse_limit and/or
join_collapse_limit to at least 15 to get the planner to do a complete
search of the join-order space.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dilip Kumar 2023-05-08 13:45:20 Re: "PANIC: could not open critical system index 2662" - twice
Previous Message Ron 2023-05-08 13:43:38 Re: huge discrepancy between EXPLAIN cost and actual time (but the table has just been ANALYZED)