Kaloyan Iliev Iliev <kaloyan@digsys.bg> writes:We recently upgrade our server from PG8.2 to 8.4. ... Here I will post explain analyze. If you think it is necessary I will post the exact query: http://explain.depesz.com/s/J0OYeah, you need to show the query. It looks like the performance problem is stemming from a lot of subselects, but it's not clear why 8.4 would be handling those worse than 8.2. regards, tom lane