Tom Lane wrote: > OK, I played around with this for a bit, and what I find is that in 8.1, > that SPIExec context is where the sort operation run by CLUSTER's > reindexing step allocates memory. Interesting. I wonder if dropping indexes could alleviate this problem. Please see another recent post of mine for context - http://groups.google.com/group/pgsql.general/browse_thread/thread/26333d69d7a311ed/39fcfa7ca91771ba?lnk=gst&q=index+angva&rnum=2 The indexes (except for the cluster indexes obviously) should be dropped and recreated later anyway. > I don't know why it sometimes fails and sometimes not --- > maybe you are reaching the swap-space limits of > the machine when you do several of these in parallel? The funny thing is that once it does fail, it fails consistently until the server is bounced - I must have run the cluster script 10 times after the initial failure. The server's 6g of RAM is normally more than enough (so normally, maintenance_work_mem is not too high) until this strange wall is hit. Another funny thing is that according to top, no more than about 700k of swap is ever used - even when the problem occurs - and the limit is 2g. Thanks a lot, Mark