From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Pazargic Antonel Ernest" <antonel(dot)pazargic(at)gmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Partitioning table - explain said that all partition tables are scanned |
Date: | 2006-04-10 22:44:30 |
Message-ID: | 1379.1144709070@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
"Pazargic Antonel Ernest" <antonel(dot)pazargic(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma Jr | 2006-04-10 22:48:16 | Re: PostgreSQL a slow DB? |
Previous Message | Tom Lane | 2006-04-10 22:34:10 | Re: Explain query on table with partition tables |