GIN pending list clean up exposure to SQL - Mailing list pgsql-hackers

From Jeff Janes
Subject GIN pending list clean up exposure to SQL
Date
Msg-id CAMkU=1x8zFkpfnozXyt40zmR3Ub_kHu58LtRmwHUKRgQss7=iQ@mail.gmail.com
Whole thread Raw
Responses Re: GIN pending list clean up exposure to SQL  (Oleg Bartunov <obartunov@gmail.com>)
Re: GIN pending list clean up exposure to SQL  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: GIN pending list clean up exposure to SQL  (Jaime Casanova <jaime.casanova@2ndquadrant.com>)
List pgsql-hackers
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?

Cheers,

Jeff
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: count_nulls(VARIADIC "any")
Next
From: Tom Lane
Date:
Subject: Re: Test code is worth the space