optimalisation with EXCEPT clause

Поиск
Список
Период
Сортировка
От Kincel, Martin
Тема optimalisation with EXCEPT clause
Дата
Msg-id A5ED43533E983E4685C9E6156BE8874F0840D83D@kenya.tronet.as
обсуждение исходный текст
Ответы Re: optimalisation with EXCEPT clause  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Список pgsql-general
Hello,


everyday I collect a couple of thousands rows of unique data from our
systems and I INSERT them into the table. Since I need no duplicate
data, I use EXCEPT clause when INSERTing, like this:

===
INSERT INTO data SELECT * FROM new_collected_data() EXCEPT SELECT * FROM
data;
===

It works exactly as I need, but there is a small issue I am thinking
about how to improve. Yes it's performance, what else? :)

Since I am INSERTing new_collected_data() in 10000-rows chunks into a
table already containing millions of rows, it takes a few minutes
(literally), which is something I understand and accept.
However, I am wondering whether there is any way how to improve the
performance, either via indices, or ALTERing TABLE with UNIQUE
constraint or something else I might have completely forgot about.

Does anyone have any recommended approach how to speed up queries
containing EXCEPT clause?


Thanks a lot,
Winco

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

Предыдущее
От:
Дата:
Сообщение: Re: [ADMIN] Query is stuck
Следующее
От: Grzegorz Jaśkiewicz
Дата:
Сообщение: Re: optimalisation with EXCEPT clause