Hello,
While understanding the effect of maintenance_work_mem on time taken
by CREATE INDEX, I observed that for the values of
maintenance_work_mem less than the value for which an internal sort is
performed, the time taken by CREATE INDEX increases as
maintenance_work_increases.
My guess is that for all those values an external sort is chosen at
some point and larger the value of maintenance_work_mem, later the
switch to external sort would be made causing CREATE INDEX to take
longer. That is a smaller value of maintenance_work_mem would be
preferred for when external sort is performed anyway. Does that make
sense?
--
Amit Langote