I've written a function which allows users to clean up the pending list. It takes the index name and returns the number of pending list pages deleted.
# select * from gin_clean_pending_list('foo_text_array_idx');
gin_clean_pending_list
------------------------
278
(1 row)
Time: 31994.880 ms
This is needed because there needs to be a way to offload this duty from the user backends, and the only other way to intentionaly clean up the list is by vacuum (and the rest of a vacuum can take days to run on a large table). Autoanalyze will also do it, but it hard to arrange for those to occur at need, and unless you drop default_statistics_target very low they can also take a long time. And if you do lower the target, it screws up your statistics, of course.
I've currently crammed it into pageinspect, simply because that is where I found the existing code which I used as an exemplar for writing this code.
But where does this belong? Core? Its own separate extension?
For a long time we have gevel extension (http://www.sigaev.ru/git/gitweb.cgi?p=gevel.git;a=summary) , which was originally developed to help us debugging indexes, but it's also contains user's functions. Your function could be there, but I have no idea about gevel itself. Probably, it should be restructurized and come to contrib. Do you have time to look into ?