Can one turn off constraints/indices temporarily?

Поиск
Список
Период
Сортировка
От
Тема Can one turn off constraints/indices temporarily?
Дата
Msg-id 200602021449.k12EnBi20504@panix3.panix.com
обсуждение исходный текст
Ответы Re: Can one turn off constraints/indices temporarily?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice


I'm sorry if this question is very naive.  I'm very green at this.

When I read the SQL code generated by pg_dump, I notice that all the
constraints and indices are defined after all the data has been
inserted.  I figure this makes the bulk transfers much faster, since
each insert can happen without the need to check constraints and/or
update indices each time.

Now, suppose that one had to insert many records at once.  Is it
possible to mimic the above strategy by turning off the constraints
and indexing temporarily (without dropping them altogether), and
turning them back on after all the inserts have been made.  (Of
course, upon turning it back on, constraints would have to be checked
and indices would need to be updated, therefore one would repay the
"time debt", but hopefully this would still be smaller than doing all
this after each insert.)

Thanks!

kj

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

Предыдущее
От: George Tichogiorgos
Дата:
Сообщение: prob in accessing psql at all
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Can one turn off constraints/indices temporarily?