Set work_mem higher for this session.

If you are going to build a large index or do some other large query that can benefit from access to more RAM, set work_mem larger for your session

set work_mem = '56GB';
-- Do your work here.
-- Then be a good neighbour.
set work_mem = default;