Re: About partitioning - Mailing list pgsql-general

From Vincenzo Romano
Subject Re: About partitioning
Date
Msg-id 3eff28921001210128y60044d44pa77362627f55fcd2@mail.gmail.com
Whole thread Raw
In response to Re: About partitioning  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Responses Re: About partitioning  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
List pgsql-general
2010/1/21 Grzegorz Jaśkiewicz <gryzman@gmail.com>:
> http://www.pubbs.net/pgsql/201001/16503/
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

Grzegorz,
Thanks for the reference, which officially is here:
http://archives.postgresql.org/pgsql-general/2010-01/msg00331.php

I confirm it wasn't easy to find that out. Maybe you can add the
snippet into the Postgresql Wiki.

One thing to add here is that I would advise against the CREATE
TABLE...INHERITS.
I find much more useful:

-- code
CREATE TABLE <partition> (
  LIKE <master>
  INCLUDING INDEXES,
  CHECK( <the condition> )
);
ALTER TABLE <partition> INHERIT <master>;
-- end code

because very often I still need the indexes in the partitions.
And in case you need the (other) constraints and the defaults, uyou
can ask for it with the INCLUDING clause.

And, BTW:
EXECUTE 'INSERT INTO '||partition-table-name||' SELECT $1.*' USING NEW;

--
Vincenzo Romano
NotOrAnd Information Technologies
NON QVIETIS MARIBVS NAVTA PERITVS

pgsql-general by date:

Previous
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: About partitioning
Next
From: Magnus Hagander
Date:
Subject: Re: 64bits or 32 bits on ESX?