Re: Very slow queries - please help. - Mailing list pgsql-performance

From Guillaume Smet
Subject Re: Very slow queries - please help.
Date
Msg-id 4385D653.7020804@openwide.fr
Whole thread Raw
In response to Re: Very slow queries - please help.  ("Bealach-na Bo" <bealach_na_bo@hotmail.com>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: "Bealach-na Bo"
Date:
Subject: Re: Very slow queries - please help.
Next
From: Tom Lane
Date:
Subject: Re: Very slow queries - please help.