"Tomeh, Husam" <htomeh@xxxxxxxxxxx> writes: > =# vacuum analyze code; > ERROR: out of memory > DETAIL: Failed on request of size 1073741820. That looks a whole lot like a corrupt-data issue. The apparent dependency on maintenance_work_mem is probably illusory --- I suspect some of your trials are selecting the corrupted row to use in the ANALYZE stats, and others are randomly selecting other rows. If you are able to pg_dump the table in question then this theory is wrong, but I'd suggest trying that first. regards, tom lane