Mario Splivalo <msplival@xxxxxxxxxxxxx> writes: > I have a quite large query that takes over a minute to run on my laptop. The EXPLAIN output you provided doesn't seem to agree with the stated query. Where'd the "service_id = 1102" condition come from? In general, I'd suggest playing around with the join order. Existing releases of PG tend to throw up their hands when faced with a mixture of outer joins and regular joins, and just join the tables in the order listed. 8.2 will be smarter about this, but for now you have to do it by hand ... regards, tom lane