Re: Strange workaround for slow query

От: Harald Fuchs
Тема: Re: Strange workaround for slow query
Дата: ,
Msg-id: pupr3cqgwq.fsf@srv.protecting.net
(см: обсуждение, исходный текст)
Ответ на: Strange workaround for slow query  ()
Список: pgsql-performance

Скрыть дерево обсуждения

Strange workaround for slow query  (, )
 Re: Strange workaround for slow query  (Yeb Havinga, )
  Re: Strange workaround for slow query  (, )
   Re: Strange workaround for slow query  (Yeb Havinga, )
    Re: Strange workaround for slow query  (, )
     Re: Strange workaround for slow query  (Yeb Havinga, )
      Re: Strange workaround for slow query  (Robert Haas, )
       Re: Strange workaround for slow query  (Tom Lane, )
        Re: Strange workaround for slow query  (Robert Haas, )
        Re: Strange workaround for slow query  (Sander Verhagen, )
 Re: Strange workaround for slow query  (Harald Fuchs, )

In article <>,
 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.


В списке pgsql-performance по дате сообщения:

От: Robert Haas
Дата:
Сообщение: Re: Strange workaround for slow query
От: Tom Lane
Дата:
Сообщение: Re: Strange workaround for slow query