Re: Particionamiento de tablas

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: "Ing(dot) Jhon Carrillo // Caracas, Venezuela" <jhon(dot)carrillo(dot)foros(at)gmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org, alvherre(at)commandprompt(dot)com
Subject: Re: Particionamiento de tablas
Date: 2005-11-29 19:11:44
Message-ID: c2d9e70e0511291111v51ba5d5dge6e047b3a3166bed@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

> > >
> > > ya coloque SET constraint_exclusion = on;
> >
> > Observa que necesitas tener restricciones CHECK apropiadas en cada
> > particion! Que tal si nos enseñas la definicion de las tablas?
>
> Esto fue lo que hice, es una prueba parecida a el ejemplo de la
> documentación, el problema es que me chequea todos los indices de las
> tablas particionadas y NO hace exclusión :
>
>
> CREATE TABLE tabla_data (
> tabla_data_id serial,
> tabla_data_date timestamp NOT NULL,
> )
>
>
>
> CREATE TABLE tabla_data_0501 (
> CHECK ( tabla_data_date >= DATE '2005-01-01' AND tabla_data_date <
> DATE '2005-01-30' )
> ) INHERITS (tabla_data);
>

OK. ya encontre el problema...

en
http://www.postgresql.org/docs/8.1/static/ddl-partitioning.html#DDL-PARTITIONING-CONSTRAINT-EXCLUSION
dice:
"
Avoid cross-datatype comparisons in the CHECK constraints, as the
planner will currently fail to prove such conditions false. For
example, the following constraint will work if x is an integer column,
but not if x is a bigint:

CHECK ( x = 1 )For a bigint column we must use a constraint like:

CHECK ( x = 1::bigint )The problem is not limited to the bigint data
type — it can occur whenever the default data type of the constant
does not match the data type of the column to which it is being
compared. Cross-datatype comparisons in the supplied queries are
usually OK, just not in the CHECK conditions.
"

Es decir, que en el check debe haber un TIMESTAMP y no DATE... porque
tu columna es de tipo TIMESTAMP

--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Andrea 2005-11-29 20:16:16 Fatal : IDENT authentication
Previous Message Raul Caso 2005-11-29 18:53:50 Re: Ayuda recuperar registros aleatorios en postgres 8.0