pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Harald Fuchs <hari.fuchs@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Strange workaround for slow query
Date: Wed, 10 Mar 2010 17:29:25 +0100
Message-ID: <pupr3cqgwq.fsf@srv.protecting.net> (raw)
References: <OF6136AD9B.D40F3AF5-ONC12576E2.002D5763-C12576E2.002FBD70@imtechrelay.nl>

In article <OF6136AD9B.D40F3AF5-ONC12576E2.002D5763-C12576E2.002FBD70@imtechrelay.nl>,
sverhagen@wps-nl.com writes:
> SELECT * FROM events_events LEFT OUTER JOIN events_event_types ON eventType_id=
> events_event_types.id WHERE severity=70 AND (eventType_id IN (71)) ORDER BY
> datetime DESC LIMIT 50;
> Now I have at least two possibilities:
> - Implementing the dummy value as shown above in my source code to improve
> query performance (dirty but effective)
> - Further investigating what is going on, which at this point is something I
> need help with

First I'd change the query.  You build an OUTER JOIN and immediately
convert it to an INNER JOIN by referencing the "severity" column.

Then show us what EXPLAIN ANALYZE says to the problem.




view thread (13+ messages)  latest in thread

Message-ID: <pupr3cqgwq.fsf@srv.protecting.net>
Permalink:  ../pupr3cqgwq.fsf@srv.protecting.net/
Also on:    postgresql.org/message-id/pupr3cqgwq.fsf@srv.protecting.net

 · 

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: hari.fuchs@gmail.com
  Subject: Re: Strange workaround for slow query
  In-Reply-To: <pupr3cqgwq.fsf@srv.protecting.net>

* 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