Bruno Baguette <bruno.baguette@xxxxxxxxx> writes: > I'm having a problem with this query (below) that takes betweend 14 and > 15 seconds to run, which is too long for the end-user. > I've done a EXPLAIN ANALYZE (below below) but I'm having difficulties to > see which part of that query is taking so many times. It's the repeatedly executed EXISTS subplan that's hurting you: > SubPlan > -> Nested Loop (cost=35.56..378.16 > rows=2 width=0) (actual time=16.511..16.511 rows=0 loops=818) 16.511 * 818 = 13505.998, so this is all but about 100 msec of the runtime. Can't tell if there's any easy way to improve it. In pre-8.4 releases trying to convert the EXISTS into an IN might help. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance