Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id A3B0014518E4 for ; Thu, 8 Dec 2011 13:29:45 -0400 (AST) Received: from smtp-sofia.digsys.bg ([193.68.3.230]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RYhmv-0007nM-4T for pgsql-performance@postgresql.org; Thu, 08 Dec 2011 17:29:45 +0000 Received: from luke.digsys.bg (luke.digsys.bg [193.68.6.22]) by smtp-sofia.digsys.bg (8.14.4/8.14.4) with ESMTP id pB8HTHj4062789 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 8 Dec 2011 19:29:22 +0200 (EET) (envelope-from kaloyan@digsys.bg) Message-ID: <4EE0F3F4.8040909@digsys.bg> Date: Thu, 08 Dec 2011 19:29:24 +0200 From: Kaloyan Iliev Iliev Reply-To: kaloyan@digsys.bg Organization: Register.BG Ltd. User-Agent: Thunderbird 2.0.0.24 (X11/20100614) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Slow query after upgrade from 8.2 to 8.4 Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -3.1 (---) X-Archive-Number: 201112/74 X-Sequence-Number: 45873 Hello All. We recently upgrade our server from PG8.2 to 8.4. Our current version is: database=> SELECT version(); version -------------------------------------------------------------------------------------------------------------------- PostgreSQL 8.4.8 on amd64-portbld-freebsd8.2, compiled by GCC cc (GCC) 4.2.2 20070831 prerelease [FreeBSD], 64-bit (1 row) I read and setup most of the tuning advices. Since the upgrade we have some very complicated reports that start working too slow. Form tens of seconds to 1 hours. I execute vacuum analyze before start the query. Here I will post explain analyze. If you think it is necessary I will post the exact query: http://explain.depesz.com/s/J0O I think the planner didn't choose the best plan. I will try to I rewrite the query and set join_collapse_limit to 1 and see what will happen. Meanwhile any suggestions are welcome. Best regards and thanks in advance for the help. Kaloyan Iliev