Re: Strange workaround for slow query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <OF6136AD9B.D40F3AF5-ONC12576E2.002D5763-C12576E2.002FBD70@xxxxxxxxxxxxxx>,
sverhagen@xxxxxxxxxx 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.


-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux