Re: Foreign key slows down copy/insert
От | Christopher Kings-Lynne |
---|---|
Тема | Re: Foreign key slows down copy/insert |
Дата | |
Msg-id | 425E88B7.6000203@familyhealth.com.au обсуждение исходный текст |
Ответ на | Re: Foreign key slows down copy/insert (Richard van den Berg <richard.vandenberg@trust-factory.com>) |
Ответы |
Re: Foreign key slows down copy/insert
Re: Foreign key slows down copy/insert |
Список | pgsql-performance |
> Thanks for the pointer. I got this from the archives: > > ------------------------ > update pg_class set reltriggers=0 where relname = 'YOUR_TABLE_NAME'; > > to enable them after you are done, do > > update pg_class set reltriggers = count(*) from pg_trigger where > pg_class.oid=tgrelid and relname='YOUR_TABLE_NAME'; > ------------------------ > > I assume the re-enabling will cause an error when the copy/insert added > data that does not satisfy the FK. In that case I'll indeed end up with > invalid data, but at least I will know about it. No it certainly won't warn you. You have _avoided_ the check entirely. That's why I was warning you... If you wanted to be really careful, you could: being; lock tables for writes... turn off triggers insert delete where rows don't match fk constraint turn on triggers commit; Chris
В списке pgsql-performance по дате отправления: