Re: [SQL] Does PostgreSQL have an UPDATE Function like UNIFY?

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: "John J(dot) Boris, Sr(dot)" <john(dot)boris(at)onlinesvc(dot)com>, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Does PostgreSQL have an UPDATE Function like UNIFY?
Date: 1999-05-30 13:13:46
Message-ID: l03130303b376e90c1682@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

At 03:34 +0300 on 29/05/1999, John J. Boris, Sr. wrote:

> I can delete the records and then add them but I think that
> might be a bit time consuming.

Frankly, I don't think it will be more time consuming. Supposing a COPY
command had to do it itself, it would have to look up each record in the
table, and replace it. So it would probably mark the old one as deleted and
insert the new record. It shouldn't be much faster than:

1) Creating a temp table with the same schema as the main one
2) copying the records into the temp table
3) deleting from the main all the records which exist in the temp
table (DELETE FROM main WHERE main.field = temp.field);
4) Inserting all records from the temp table using INSERT INTO... SELECT.
5) Dropping the temp table
6) Vacuuming

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John J. Boris, Sr. 1999-05-30 15:31:29 Re: [SQL] Does PostgreSQL have an UPDATE Function like UNIFY?
Previous Message Herouth Maoz 1999-05-30 11:24:54 Re: [SQL] 2 Table Select