Slow delete by table with reference to him slef.

Поиск
Список
Период
Сортировка
От pginfo
Тема Slow delete by table with reference to him slef.
Дата
Msg-id 3DEE22FC.9E00901D@t1.unisoftbg.com
обсуждение исходный текст
Список pgsql-general
Hi,

CREATE TABLE mytable (
  "ids" name NOT NULL,
  "myref" name,
  CONSTRAINT "a_doc_pkey" PRIMARY KEY ("ids"),
  CONSTRAINT "$1" FOREIGN KEY ("myref") REFERENCES "mytable" ("ids") ON
DELETE NO ACTION ON UPDATE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)



I put in the table ~ 100 000 records and after it I try to delete all
the records with:
delete from mytable;

The delete take ~ 1 h. And the processor usage is ~ 100 %.

I think the problem is in the reference to him self.

How can I improve this preformance.

For example in oracle I set all myref's to NULL and the delete is very
fast.

regards,
ivan.



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

Предыдущее
От: Marcus Claesson
Дата:
Сообщение: Problems with DBD::Pg installation on Tru64
Следующее
От: Matthew Gabeler-Lee
Дата:
Сообщение: Re: 7.3 no longer using indexes for LIKE queries