Re: Partitioning table - explain said that all partition tables are scanned

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Partitioning table - explain said that all partition tables are scanned
Дата
Msg-id 1379.1144709070@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Partitioning table - explain said that all partition tables are scanned  ("Pazargic Antonel Ernest" <antonel.pazargic@gmail.com>)
Список pgsql-novice
"Pazargic Antonel Ernest" <antonel.pazargic@gmail.com> writes:
> DDL-s
> Master table:
> create table master(masterid integer default nextval('seq_master'), nume
> varchar(25) not null, timpul timestamp not null, constraint pk_master
> primary key (masterid), constraint uq1_master unique (nume));

> Partition tables:
> create table master_012006(constraint ck1_master012006 check (timpul >=
> DATE '2006-01-01' AND timpul < DATE '2006-02-01') ) inherits (master);

Oh, there's your problem: you need to lose the unnecessary DATE type
coercions and just let the constants in the constraints be timestamps.

The way you've set this up, the constraints involve cross-datatype
comparisons (timestamp vs date) and the planner is not very good about
proving inferences involving cross-type comparisons.  The difficulty
is basically that it can't assume that '>' on dates has anything to do
with '>' on timestamps --- there is nothing in the system catalogs that
justifies assuming that they sort in compatible fashions.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Explain query on table with partition tables
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: PostgreSQL a slow DB?