1

Suppose I were to run the following. The first line shows the server's default maintenance_work_mem value.

mhildreth=# show maintenance_work_mem;
 maintenance_work_mem
----------------------
 16MB
(1 row)

mhildreth=# set maintenance_work_mem = '256MB';
SET

mhildreth=# CREATE INDEX CONCURRENTLY ON my_table(columns);

mhildreth=# set maintenance_work_mem = DEFAULT;
SET

What would be used for maintenance_work_mem of the index creation?

1 Answer 1

1

In your example, the maintenance_work_mem you have set of 256MB should be seen by the subsequent CREATE INDEX CONCURRENTLY command, because you have changed this GUC inside your session.

In fact, the docs suggest bumping up maintenance_work_mem (as you showed) for just such a purpose.

1
  • Thanks. I think I was under the mistaken impression that CREATE INDEX CONCURRENTLY would actually kick off some background job to do the index creation, and was worried that the background job wouldn't have the changes to the GUC. Since this assumption is false, it does make sense that the new config would hold. May 25, 2016 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.