Help, 400 million rows, query slow, I stopped after 5 days

Поиск
Список
Период
Сортировка
От Christian Hofmann
Тема Help, 400 million rows, query slow, I stopped after 5 days
Дата
Msg-id 00b801c625b2$30d04600$9000a8c0@taschenrechner
обсуждение исходный текст
Ответы Re: Help, 400 million rows, query slow, I stopped after 5 days  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Hello,

I have a little table with 400,000,000 rows of text (about 40 chars each).
I want to delete values that are exisiting more than two times.

So I created a new table (table2), the same than the first, but with an
unique index.
Then i put in the following query:

INSERT INTO table2 (my_col) SELECT DISTINCT my_col from table1

But this query was so slow that I stopped it. I let it run for five days!

In the Server there is only 1 GB RAM. My_col is using a bitmap index.

Maybe I should creating a trigger on table2 that will check before inserting
if this value is already in the table2.


Or is it possible to just use the unique index in table2 and do something
like:

INSERT INTO table2 (my_col) SELECT my_col from table1

And ignoring there errors that are thrown because there are duplicate
values?

I hope you can help me,

Thank you,

Christian



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: wrong objects order using pg_dump
Следующее
От: Oleg
Дата:
Сообщение: Re: wrong objects order using pg_dump