Re: lazy_truncate_heap()
От | Heikki Linnakangas |
---|---|
Тема | Re: lazy_truncate_heap() |
Дата | |
Msg-id | 4963611F.5060901@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: lazy_truncate_heap() (Simon Riggs <simon@2ndQuadrant.com>) |
Ответы |
Re: lazy_truncate_heap()
|
Список | pgsql-hackers |
Simon Riggs wrote: > On Wed, 2008-12-31 at 21:45 +0200, Heikki Linnakangas wrote: >>> Can I fix? >> Yes please. > > Fix attached. > --- 183,192 ---- > * number of pages. Otherwise, the time taken isn't worth it. > */ > possibly_freeable = vacrelstats->rel_pages - vacrelstats->nonempty_pages; > ! if (vacrelstats->tuples_deleted > 0 && > ! (possibly_freeable >= REL_TRUNCATE_MINIMUM || > ! (possibly_freeable >= vacrelstats->rel_pages / REL_TRUNCATE_FRACTION && > ! possibly_freeable > 0))) > lazy_truncate_heap(onerel, vacrelstats); > Where did that "tuples_deleted > 0" condition come from? It seems counter-productive; if a previous vacuum failed to acquire the lock, subsequent vacuums wouldn't even try if they don't remove any tuples. How about simply: *************** *** 183,190 **** * number of pages. Otherwise, the time taken isn't worth it. */ possibly_freeable = vacrelstats->rel_pages- vacrelstats->nonempty_pages; ! if (possibly_freeable >= REL_TRUNCATE_MINIMUM || ! possibly_freeable >= vacrelstats->rel_pages / REL_TRUNCATE_FRACTION) lazy_truncate_heap(onerel, vacrelstats); /* Vacuum the Free Space Map */ --- 183,191 ---- * number of pages. Otherwise, the time taken isn't worth it. */ possibly_freeable = vacrelstats->rel_pages- vacrelstats->nonempty_pages; ! if (possibly_freeable > 0 && ! (possibly_freeable >= REL_TRUNCATE_MINIMUM || ! possibly_freeable >= vacrelstats->rel_pages / REL_TRUNCATE_FRACTION)) lazy_truncate_heap(onerel, vacrelstats); /* Vacuum the Free Space Map */ -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: