X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ECA32D7282 for ; Thu, 24 Nov 2005 11:03:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50669-01 for ; Thu, 24 Nov 2005 15:03:51 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr1.postgresql.org (Postfix) with ESMTP id 40D82DBCA5 for ; Thu, 24 Nov 2005 11:03:44 -0400 (AST) Received: from [213.162.49.207] (gs.team.openwide.fr [213.162.49.207]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id 4EB4B5CF6; Thu, 24 Nov 2005 16:03:48 +0100 (CET) Message-ID: <4385D653.7020804@openwide.fr> Date: Thu, 24 Nov 2005 16:03:47 +0100 From: Guillaume Smet User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bealach-na Bo CC: pgsql-performance@postgresql.org Subject: Re: Very slow queries - please help. References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/495 X-Sequence-Number: 15752 Hi, > I'm also sending the EXPLAIN outputs. Please provide EXPLAIN ANALYZE outputs instead of EXPLAIN. You will have more information. Indexes on your tables are obviously missing. You should try to add: CREATE INDEX idx_node_filter ON node(name, type, usage); CREATE INDEX idx_job_log_filter ON job_log(job_name, job_start, job_stop); I'm not so sure it's a good idea to add job_stop in this index as you have an IS NULL in your query so I'm not sure it can be used. You should try it anyway and remove it if not needed. I added all your search fields in the indexes but it depends a lot on the selectivity of your conditions. I don't know your data but I think you understand the idea. HTH -- Guillaume