Re: Directing Partitioned Table Searches

Поиск
Список
Период
Сортировка
От Vick Khera
Тема Re: Directing Partitioned Table Searches
Дата
Msg-id AANLkTikmJ_X8HWAqcQ2Mt7ydhbOKE90kXV_tyc_u+PgQ@mail.gmail.com
обсуждение исходный текст
Ответ на Directing Partitioned Table Searches  (Bill Thoen <bthoen@gisnet.com>)
Ответы Re: Directing Partitioned Table Searches  (Bill Thoen <bthoen@gisnet.com>)
Список pgsql-general
On Fri, Feb 4, 2011 at 7:35 PM, Bill Thoen <bthoen@gisnet.com> wrote:
> And this selection will result in ALL partitions being searched. But why?
> SELECT cluid, farmid
> FROM clu JOIN farms ON ogc_fid=link
> WHERE state=zone

The constraint exclusion code does not execute your constraints to
decide whether to look at your partition; it examines the query and
the constraint and does a "proof" to try to exclude the partition. If
it cannot do that proof, it will scan that table.

> I'd like to be able to run some queries w/o the overhead of searching
> partitions unnecessarily. Can it be done?

Your best bet is to know which partition you need and write your query
that way dynamically, rather than trying to use a generic query and
have the DB do the constraint exclusion.  In your above case, if you
know that 'zone' will limit you to just the MI table, then specify the
MI table instead of the base clu table.

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

Предыдущее
От: Vick Khera
Дата:
Сообщение: Re: tuning postgresql writes to disk
Следующее
От: Nicolas Grilly
Дата:
Сообщение: Re: Why "copy ... from stdio" does not return immediately when reading invalid data?