Partitioning table with billion row

From: nuklea <nuklea(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Partitioning table with billion row
Date: 2013-09-19 09:57:50
Message-ID: CAFVF5gOyavQvjYVRdu9AGhJSSLrcH2bZmq2tX1YNuWLnhGuzaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a big table referenced by other tables and need to split the table
on several parts.

1. I create table by CREATE TABLE product_part0 () INHERITS (product);
2. Move some rows to product_part0 by INSERT INTO product_part0 SELECT *
FROM ONLY product ORDER BY id LIMIT 200;
3. Now I need to remove duplicates from master-table. Run DELETE FROM
ONLY product WHERE id IN (SELECT id FROM product_part0);

With result:

ERROR: update or delete on table "product" violates foreign key constraint
"product_id_refs" on table "searchcache"
DETAIL: Key (id)=(13375) is still referenced from table "searchcache".

So, how to delete duplicate rows?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Patrick Dung 2013-09-19 10:02:24 Re: the new checksum feature
Previous Message Torsten Förtsch 2013-09-19 09:32:24 the new checksum feature