Re: order by index, and inheritance

Поиск
Список
Период
Сортировка
От Michiel Meeuwissen
Тема Re: order by index, and inheritance
Дата
Msg-id 20040422110214.GH6870@michiel.omroep.nl
обсуждение исходный текст
Ответ на order by index, and inheritance  (Michiel Meeuwissen <Michiel.Meeuwissen@omroep.nl>)
Список pgsql-performance
Rod Taylor <pg@rbt.ca> wrote:
> The scan is picking the best method for grabbing everything within the
> table, since it is not aware that we do not require everything.

Hmm. That is a bit silly. Why does it use the index if select only from
mm_mediasources?

> You can explicitly tell it what you want to do via:
>
> SELECT *
>   FROM (SELECT * FROM mm_mediasources ORDER BY number DESC LIMIT 20
>   UNION SELECT * FROM <subtable> ORDER BY number DESC LIMIT 20) AS tab
>  ORDER BY number DESC LIMIT 20

I think you meant 'only mm_mediasources', and btw order by and limit are not
accepted before union, so the above query does not compile.

I can't figure out any acceptable work-around. Even if something as the
above would work, it still would be hardly elegant, and you can as well have
no support for inheritance (actually, you can _better_ have no inheritance,
because at least it is clear what works then).

Michiel

btw. Why are these messages not appearing on the list itself?

--
Michiel Meeuwissen
Mediapark C101 Hilversum
+31 (0)35 6772979
nl_NL eo_XX en_US
mihxil'
 [] ()

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

Предыдущее
От: Michiel Meeuwissen
Дата:
Сообщение: Re: order by index, and inheritance
Следующее
От: "Chris Hoover"
Дата:
Сообщение: Re: Help with performance problems