Re: Limit + group + join

От: Merlin Moncure
Тема: Re: Limit + group + join
Дата: ,
Msg-id: 6EE64EF3AB31D5448D0007DD34EEB3417DD1F1@Herge.rcsinc.local
(см: обсуждение, исходный текст)
Ответ на: Limit + group + join  (Tobias Brox)
Список: pgsql-performance

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

Limit + group + join  (Tobias Brox, )
 Re: Limit + group + join  ("Jeffrey W. Baker", )
  Re: Limit + group + join  (Tobias Brox, )
  Re: Limit + group + join  ("Jeffrey W. Baker", )
 Re: Limit + group + join  (Mark Kirkwood, )
  Re: Limit + group + join  (Tobias Brox, )
  Re: Limit + group + join  (Stephan Szabo, )
  Re: Limit + group + join  (Tom Lane, )
   Re: Limit + group + join  (Mark Kirkwood, )
    Re: Limit + group + join  (Tom Lane, )
   Re: Limit + group + join  (Mark Kirkwood, )
    Re: Limit + group + join  (Tom Lane, )
     Re: Limit + group + join  (Mark Kirkwood, )
      Re: Limit + group + join  (Tobias Brox, )
   Re: Limit + group + join  (Greg Stark, )
 Re: Limit + group + join  ("Merlin Moncure", )
 Re: Limit + group + join  ("Merlin Moncure", )

Mark Kirkwood
> > The 'desc' seems to be the guy triggering the sort, e.g:
>
> Oh; really an accident that I didn't notice myself, I was actually
going
> to
> remove all instances of "desc" in my simplification, but seems like I
> forgot.

If desc is the problem you can push the query into a subquery without
sorting and sort the result.  This is called an inline view.  Sometimes
you can pull a couple of tricks to force the view to materialize before
it is sorted.

aka
select q.*
from
(
   some_complex_query
) q order by ...;

Merlin


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

От: Bruno Wolff III
Дата:
Сообщение: Re: How does the planner execute unions?
От: Arjen van der Meijden
Дата:
Сообщение: Re: Inefficient queryplan for query with intersectable