Re: What's the fastest way to do this?

Поиск
Список
Период
Сортировка
От Einar Karttunen
Тема Re: What's the fastest way to do this?
Дата
Msg-id 20011109083859.A6858@cs.helsinki.fi
обсуждение исходный текст
Ответ на What's the fastest way to do this?  (Orion <o2@trustcommerce.com>)
Список pgsql-general
On Thu, Nov 08, 2001 at 11:58:49AM -0800, Orion wrote:
>
> I have several really big tables that have columns uniquely identified by
> single or multiple rows.  [ I have about 25 tables, 10k to 500k rows
> per table ]
>
> Each day I get a flat file of updates.  I have no way of knowing which
> lines in the file are new records and which are updates for existing
> records.
>
> I need a way to insert the new ones and update the old ones.   I have
> a couple of ideas but none of them seem fast enough ( I will soon
> be getting updates faster than I can feed them into the database ).
>
Hello

I was facing a similar problem some time ago. My solution was to create
a temp table and COPY the new data to it. After that I deleted all records
in the original table which existed in the temporary table. Then I just
did a insert from a select * from the temp table. Of course with this
approach you have to lock the tables.

- Einar Karttunen







В списке pgsql-general по дате отправления:

Предыдущее
От: Tielman J de Villiers
Дата:
Сообщение: Re: PSQL anc compile errors
Следующее
От: Tielman J de Villiers
Дата:
Сообщение: Re: PSQL anc compile errors