Re: How to increase row deletion efficiency?

Поиск
Список
Период
Сортировка
От Alexander Stanier
Тема Re: How to increase row deletion efficiency?
Дата
Msg-id 43AADECF.8070702@egsgroup.com
обсуждение исходный текст
Ответ на Re: How to increase row deletion efficiency?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Have only just had a chance to try this. There were several missing indexes on the referencing columns including one
ona table of circa 150K records. It now completes in a couple of minutes. Also it appears to be quicker if one doesn't
deferthe constraints. Thanks for the advice.<br /><br /> Regards, Alex.<br /><br /> Tom Lane wrote: <blockquote
cite="mid29270.1133968316@sss.pgh.pa.us"type="cite"><pre wrap="">Alexander Stanier <a class="moz-txt-link-rfc2396E"
href="mailto:alexander.stanier@egsgroup.com"><alexander.stanier@egsgroup.com></a>writes: </pre><blockquote
type="cite"><prewrap="">I am currently trying to separate two environments contained in one 
 
database. Essentially I need to break that one database down into two 
with a portion of the data going to each new database. I am intending to 
achieve this by duplicating the database and then stripping out the data 
that is not required in each database. I have started by trying to 
delete data from a set of 28 related tables, however the performance 
appears to be terrible. I am deleting from a table called document which 
cascades down to 27 tables underneath it linked by various cascading 
foreign key constraints. Some of these subsidiary tables have as many as 
a couple of million records.   </pre></blockquote><pre wrap="">
Do you have indexes on the referencing columns?  PG enforces an index on
the referenced column, but not on the other end, and DELETE is where it
will hurt if you haven't got one.
        regards, tom lane
 </pre></blockquote>

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Querying date_time for date only ?
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Does VACUUM reorder tables on clustered indices