Re: Partitioned Tables and ORDER BY

Поиск
Список
Период
Сортировка
От Craig James
Тема Re: Partitioned Tables and ORDER BY
Дата
Msg-id 4ADC9EEB.4090500@emolecules.com
обсуждение исходный текст
Ответ на Re: Partitioned Tables and ORDER BY  (Joe Uhl <joeuhl@gmail.com>)
Список pgsql-performance
Joe Uhl wrote:
> This seems like a pretty major weakness in PostgreSQL partitioning.  I
> have essentially settled on not being able to do queries against the
> parent table when I want to order the results.  Going to have to use a
> Hibernate interceptor or something similar to rewrite the statements so
> they hit specific partitions, will be working on this in the coming week.
>
> This weakness is a bummer though as it makes partitions a lot less
> useful.  Having to hit specific child tables by name isn't much
> different than just creating separate tables and not using partitions at
> all.

I wonder if the "offset 0" trick would work here?  I was told (for a different question) that the planner can't merge
levelsif there's an offset or limit on a subquery.  So you might be able to do something like this: 

  select ... from (select ...  offset 0) as foo order by ...

In other words, put your primary query as a sub-select without the sort criterion, with the "offset 0" as a sort of
roadblockthat the planner can't get past.  Then the outer select does the sorting, without affecting the plan for the
innerselect. 

Craig

В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Calculation of unused columns
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Calculation of unused columns