Re: copy table from file: with row replacement?

Поиск
Список
Период
Сортировка
От Florian G. Pflug
Тема Re: copy table from file: with row replacement?
Дата
Msg-id 45A83F90.4090008@phlo.org
обсуждение исходный текст
Ответ на Re: copy table from file: with row replacement?  (Michael Enke <michael.enke@wincor-nixdorf.com>)
Список pgsql-hackers
Michael Enke wrote:
> This works for small amount of data. But for large amount of data
> the join takes a lot of time.

It certainly is faster then anly algorithm that checks for duplicates
for each lines of copy input could ever be. Especially for joins, doing
them in one large batch allows you to use better algorithms then looping
over one table, and searching for matching rows in the other - which is
exactly what copy would need to do if it had an "replace on duplicate"
flag.

I think the fastest way to join two large tables would be a mergejoin.
Try doing an "explain select" (or "explain delete") to see what algorithm
postgresc chooses. Check if you actually declared your primary key
in both tables - it might help postgres to know that the column you're joining
in is unique. Also check your work_mem setting - if this is set too low,
it often forces postgres to use inferior plans becaues it tries to save memory.

greetings, Florian Pflug



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

Предыдущее
От: Michael Enke
Дата:
Сообщение: Re: copy table from file: with row replacement?
Следующее
От: Tatsuo Ishii
Дата:
Сообщение: Re: Request for review: tsearch2 patch