> > That is on a Dual 1Ghz P3, 1gb ram > [..] > > > sort_mem = 65536 # min 64, size in KB > > Depending on the usage of your database this is a very high value. Every > sort (including internal sort for merge joins p.e.) is allowed to take 64 > MB. If one query needs three sorts, that query is allowed to take 192 MB > memory. > > It's much cheaper to let the database use temporary files for sorting > than to risk swapping.
64MB in a 1024MB box is not much, even when several sorts are involved. Atleast not in my environment. I do not think that this is the generally best value to use for everybody, but it is pretty optimal here. I just checked the statistics (2min poll interval) for the server, and the max ram used during the last 4 months was 11.6% But yes don't take that number as a general guideline for a very busy server, it could result in memory shortage. In any case 1MB is too little for just about any real workload, and ram beeing so cheap today.. No excuse for running a memory starved server. -=Dead2=-