Fabien COELHO <coelho@cri.ensmp.fr> writes:
>> I don't quite understand your request. You have REINDEX TABLE which
>> is able to reindex all the indexes of a table one by one, […]
> I understood the request as the scan should be factored out, so that
> reindexing a table with multiple indexes would cost only one seq scan.
I'm not totally convinced that that would be an improvement.
For starters, one would presumably have to divide up maintenance_work_mem
per index, which would be a substantial penalty for some index types.
Also, you'd be creating more randomized I/O on the index-writing side
of the equation (for those index types that write the index during the
scan).
It might net out as a win anyway depending on context, but I don't
think it's as clear-cut as the OP seems to think.
regards, tom lane