Re: [SQL] [GENERAL] How to split a table? - Mailing list pgsql-novice

From A. Kretschmer
Subject Re: [SQL] [GENERAL] How to split a table?
Date
Msg-id 20061017091237.GA19268@a-kretschmer.de
Whole thread Raw
In response to How to split a table?  ("Felix Zhang" <felix.zhang.2005@gmail.com>)
List pgsql-novice
am  Tue, dem 17.10.2006, um  1:53:35 -0700 mailte Gregory S. Williamson folgendes:
> Perhaps something like:
>
> CREATE TABLE foo2 AS SELECT * FROM foo WHERE (rand() <= 0.60);

Then we have 2 tables: one with 100% data and one with around 60% ;-)
If the table contains a primary key you can delete simple the copied
records from the origin table.

(delete from origin where pk in (select pk from copy);


>
> -----Original Message-----

Please, no top-posting with fullquote below.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

pgsql-novice by date:

Previous
From: "Felix Zhang"
Date:
Subject: Re: [GENERAL] How to split a table?
Next
From: "A. Kretschmer"
Date:
Subject: Re: [GENERAL] Any documatation about porting from Oracle to PostgreSQL