From: | rdeleonp(at)gmail(dot)com |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: TWO SAME TABLES, ONE UPDATED. HOW TO SYNC THE OTHER? |
Date: | 2007-05-13 09:21:30 |
Message-ID: | 1179048090.950809.95530@q75g2000hsh.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On May 11, 11:06 pm, "L. Berger" <straightfwd(dot)(dot)(dot)(at)gmail(dot)com> wrote:
> Hello
>
> I havetwotables-- A and B. The structure of both is thesame. Only,
> B has many indexes and is used for heavy duty SELECTs. On theother
> hand, A only accepts heavy duty INSERTs, so has onlyoneprimary key
> index.
>
> So my DB design is such that A is only an INSERT table. Periodically,
> say every 20 minutes or so, I would like to take all the new INSERTs
> from table A and put them into B.
>
> Is there any clever command to accomplish this? I'd rather not write a
> PHP script with SQL to take every single new record, and update every
> column of a new row in table B. For instance, can I do a replication
> of onlytables, not databases?
>
> Thanks for any pointers!!
>
> LB
Assuming ID is PK:
INSERT INTO b
SELECT *
FROM a
WHERE NOT EXISTS (
SELECT 1
FROM b
WHERE b.ID = a.ID
)
From | Date | Subject | |
---|---|---|---|
Next Message | Rodrigo De León | 2007-05-13 09:44:45 | Re: Indice en Date |
Previous Message | Kevin Hunter | 2007-05-13 03:46:00 | Re: Streaming large data into postgres [WORM like applications] |