join two tables without a key

From: Dino Vliet <dino_vliet(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: join two tables without a key
Date: 2010-04-03 10:16:09
Message-ID: 375015.77819.qm@web51102.mail.re2.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi postgresql list,
If I have two tables with the same number of rows but different columns and I want to create one table out of them what would be the way to do that in postgresql?

Table A has N number of rows and columns X,Y,Z and Table B has N number of rows and P,Q,R as columns. None of the tables have a column which can be used as a key. 

The resulting table should have N number of rows and X,Y,Z,P,Q,R as columns.

1) How to accomplish this is plain SQL? Join on rowid?

2) What would a PL-pgsql program look like to accomplish ths?

3) If N=10000000 and the two tables have 45 columns with mixed integer and character values, what would be the most efficient approach (fastest) and why?

Thanks in advanced

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2010-04-03 11:01:47 Re: join two tables without a key
Previous Message Craig Ringer 2010-04-03 08:55:03 Re: Performance statistics