pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedwork on some tables in the same time.
5+ messages / 3 participants
[nested] [flat]
* work on some tables in the same time.
@ 2000-09-13 14:40 Jerome Raupach <jraupach@intelcom.fr>
0 siblings, 2 replies; 5+ messages in thread
From: Jerome Raupach @ 2000-09-13 14:40 UTC (permalink / raw)
To: pgsql-sql
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 ;
------------------------------------------------------------------
CREATE TABLE table1_1( INT2 f1, INT2 f2, INT2 f3, INT2 f4 );
CREATE TABLE table1_2( INT2 f1, INT2 f2, INT2 f3, INT2 f4 );
...
CREATE TABLE table2_1( INT2 f1, INT2 f2, INT2 f3 );
CREATE TABLE table2_2( INT2 f1, INT2 f2, INT2 f3 );
...
------------------------------------------------------------------
Anyone can help me ?
Thanks in advance.
Jerome.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: work on some tables in the same time.
@ 2000-09-13 15:48 Ian Turner <vectro@pipeline.com>
parent: Jerome Raupach <jraupach@intelcom.fr>
1 sibling, 1 reply; 5+ messages in thread
From: Ian Turner @ 2000-09-13 15:48 UTC (permalink / raw)
To: Jerome Raupach <jraupach@intelcom.fr>; +Cc: 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-----
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: work on some tables in the same time.
@ 2000-09-13 15:58 Jerome Raupach <jraupach@intelcom.fr>
parent: Ian Turner <vectro@pipeline.com>
0 siblings, 1 reply; 5+ messages in thread
From: Jerome Raupach @ 2000-09-13 15:58 UTC (permalink / raw)
To: Ian Turner <vectro@pipeline.com>; +Cc: pgsql-sql
Thanks, but:
testdb=#CREATE VIEW tableselecttemp AS SELECT DISTINCT f1, f2, f3 FROM
table1_n;
ERROR: DISTINCT not supported in views
Jerome.
Ian Turner wrote:
>
> -----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-----
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: work on some tables in the same time.
@ 2000-09-13 16:14 Ian Turner <vectro@pipeline.com>
parent: Jerome Raupach <jraupach@intelcom.fr>
0 siblings, 0 replies; 5+ messages in thread
From: Ian Turner @ 2000-09-13 16:14 UTC (permalink / raw)
To: Jerome Raupach <jraupach@intelcom.fr>; +Cc: pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> testdb=#CREATE VIEW tableselecttemp AS SELECT DISTINCT f1, f2, f3 FROM
> table1_n;
> ERROR: DISTINCT not supported in views
In that case, you'll have to create a temporary table instead. This may
actually be faster, because you only have to search table1_n once.
Ian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE5v6gBfn9ub9ZE1xoRAh1GAKC7SvP2orhC9lZsC0BJaqntXGlmOQCfTwj4
/Qmr4PIfcE7Ue9UEZAWGhrM=
=VV5w
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: work on some tables in the same time.
@ 2000-09-13 16:39 Stephan Szabo <sszabo@megazone23.bigpanda.com>
parent: Jerome Raupach <jraupach@intelcom.fr>
1 sibling, 0 replies; 5+ messages in thread
From: Stephan Szabo @ 2000-09-13 16:39 UTC (permalink / raw)
To: Jerome Raupach <jraupach@intelcom.fr>; +Cc: pgsql-sql
I'm assuming you want "n" to be replaced by the numbers up to
the last one where there is a table1_n and table2_n, right?
I'd suggest looking and PL/TCL (or if you can wait for 7.1, you
can probably do it in PL/PGSQL as well with the new exec stuff.)
and writing a function that does the inserts for you.
Stephan Szabo
sszabo@bigpanda.com
On Wed, 13 Sep 2000, Jerome Raupach wrote:
> 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 ;
>
> ------------------------------------------------------------------
>
> CREATE TABLE table1_1( INT2 f1, INT2 f2, INT2 f3, INT2 f4 );
> CREATE TABLE table1_2( INT2 f1, INT2 f2, INT2 f3, INT2 f4 );
> ...
>
> CREATE TABLE table2_1( INT2 f1, INT2 f2, INT2 f3 );
> CREATE TABLE table2_2( INT2 f1, INT2 f2, INT2 f3 );
> ...
>
> ------------------------------------------------------------------
>
> Anyone can help me ?
> Thanks in advance.
>
> Jerome.
>
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2000-09-13 16:39 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-09-13 14:40 work on some tables in the same time. Jerome Raupach <jraupach@intelcom.fr>
2000-09-13 15:48 ` Ian Turner <vectro@pipeline.com>
2000-09-13 15:58 ` Jerome Raupach <jraupach@intelcom.fr>
2000-09-13 16:14 ` Ian Turner <vectro@pipeline.com>
2000-09-13 16:39 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox