On Mon, Jun 18, 2018 at 4:05 PM, Peter Geoghegan <p...@bowt.ie> wrote: > Finally, doing things this way would let you delete multiple > duplicates in one shot, as I described in an earlier e-mail. Only a > single descent of the tree is needed to delete quite a few index > tuples, provided that they all happen to be logical duplicates. Again, > your background worker will take advantage of this.
BTW, when you do this you should make sure that there is only one call to _bt_delitems_vacuum(), so that there aren't too many WAL records. Actually, that's not quite correct -- there should be one _bt_delitems_vacuum() call *per leaf page* per bttargetdelete() call, which is slightly different. There should rarely be more than one or two calls to _bt_delitems_vacuum() in total, because your background worker is only going to delete one heap page's duplicates per bttargetdelete() call, and because there will be locality/correlation with my TID order patch. -- Peter Geoghegan