pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guillaume Smet <guillaume.smet@openwide.fr>
To: Bealach-na Bo <bealach_na_bo@hotmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Very slow queries - please help.
Date: Thu, 24 Nov 2005 16:03:47 +0100
Message-ID: <4385D653.7020804@openwide.fr> (raw)
In-Reply-To: <BAY101-F398BCDC77A2C41D225B978AD540@phx.gbl>
References: <BAY101-F398BCDC77A2C41D225B978AD540@phx.gbl>

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



view thread (9+ messages)  latest in thread

Message-ID: <4385D653.7020804@openwide.fr>
Permalink:  ../4385D653.7020804@openwide.fr/
Also on:    postgresql.org/message-id/4385D653.7020804@openwide.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: guillaume.smet@openwide.fr, bealach_na_bo@hotmail.com
  Subject: Re: Very slow queries - please help.
  In-Reply-To: <4385D653.7020804@openwide.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox