Re: Efficient Way to Merge Two Large Tables

From: Ben Chobot <bench(at)silentmedia(dot)com>
To: Joshua Rubin <jrubin(at)esoft(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Efficient Way to Merge Two Large Tables
Date: 2010-07-13 22:22:15
Message-ID: 5E2BEA57-1A1A-485D-B443-163DD0E5BFA1@silentmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jul 13, 2010, at 1:46 PM, Joshua Rubin wrote:

> Hi,
>
> I have two tables each with nearly 300M rows. There is a 1:1
> relationship between the two tables and they are almost always joined
> together in queries. The first table has many columns, the second has
> a foreign key to the primary key of the first table and one more
> column. It is expected that for every row in table1, there is a
> corresponding row in table2. We would like to just add the one column
> to the first table and drop the second table to allow us to index this
> extra column.

Stupid question before you do this: is there a reason the design was split like this? For instance, if the table with the id and the single field get updated a lot, while the other table almost never changes, maybe this design isn't so bad.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua Rubin 2010-07-13 22:54:22 Re: Efficient Way to Merge Two Large Tables
Previous Message Tom Lane 2010-07-13 21:38:43 Re: Idle In Transaction