From: | Ian Turner <vectro(at)pipeline(dot)com> |
---|---|
To: | Jerome Raupach <jraupach(at)intelcom(dot)fr> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: work on some tables in the same time. |
Date: | 2000-09-13 15:48:20 |
Message-ID: | Pine.LNX.4.21.0009130845070.1180-100000@crafter.house |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> I want to execute this query on some table2 in the same time :
>
> INSERT INTO table2_n(f1, f2, f3)
> SELECT DISTINCT f1, f2, f3 FROM table1_n ;
One way would be to do:
BEGIN
CREATE VIEW tableselecttemp AS
SELECT DISTINCT f1, f2, f3 FROM table1_n;
INSERT INTO table2_n(f1, f2, f3) SELECT * FROM tableselecttemp;
INSERT INTO table2 (f1, f2, f3) SELECT * FROM tableselecttemp;
DROP VIEW tableselecttemp;
ROLLBACK;
Alternatively, run the select query twice without the temporary
view. You'll have to try it both ways, on a realistic data set, to see
which is faster for you.
Ian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE5v6HGfn9ub9ZE1xoRAuo0AJwNCXhjE4WWH0WMeZrLZCjrR/H37ACZAR4N
FkuWQ4rEUUMI6bCcZkCU3XA=
=q6gb
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Jerome Raupach | 2000-09-13 15:58:05 | Re: work on some tables in the same time. |
Previous Message | Josh Berkus | 2000-09-13 15:46:03 | Re: PLSQL |