On 20/06/2022 17:47, Peter Geoghegan
wrote:
Yes, this is expected. Parallel CREATE INDEX performs its parallel sort by having workers generate sorted runs, which are written to temp files, and then having the leader process merge the sorted runs together as the index is built.
Just to make sure we are on the same page: every parallel 'CREATE INDEX' writes to temp files, ok.
But why the temp files are always on disk and not in RAM as other operations do?
In the case where there is amble maintenance_work_mem, all writes to and reads from temp files will be sequential.