Query plan optimization: sorting vs. partitioning

Поиск
Список
Период
Сортировка
От Sergey Zaharchenko
Тема Query plan optimization: sorting vs. partitioning
Дата
Msg-id AANLkTi=Yg_Vk_YE5tsWBBz+g7rT2zhjf+7ummVMTgV6M@mail.gmail.com
обсуждение исходный текст
Ответы Re: Query plan optimization: sorting vs. partitioning  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello list,

I have a large time-indexed table (states) partitioned into several
tables based on the date. The smaller tables are clustered by their
time indices.The main table is empty.

I need to select some data in the time order. When I query a separate
smaller table, the index is used an no sorting is needed. However,
when I query the main table, it occurs:
...
  ->  Sort ...
         Sort Key: ...
         Sort Method: ...
         ->  Result ...
               ->  Append ...
                     ->  Seq Scan on states
                           Filter: ...
                     ->  Seq Scan on states_20101206
                           Filter: ...
...

I see the database doesn't understand that there are no entries in the
main table, so it has to assume the Append data is not ordered. Is
there a way to avoid sorting?

Please CC me as I'm not on the list. Thanks in advance,

--
DoubleF

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

Предыдущее
От: Bill Moran
Дата:
Сообщение: Re: Why does my DB size differ between Production and DR? (Postgres 8.4)
Следующее
От: Wouter D'Haeseleer
Дата:
Сообщение: Hot-Standby and sequences