本文详细介绍PostgreSQL的磁盘空间占用问题
Remember,thisisadatabaseclusterwidesetting.Sobumpitupenoughtocoveralldatabasesinyourdatabasecluster.Also,eachFSMpageuses6bytesofRAMforadministrativeoverhead,soincreasingFSMsubstantiallyonsystemslowonRAMmaybecounter-productive.
3.4max_fsm_relations
Thissettingdictateshowmanynumberofrelations(tables)willbetrackedinfreespacemap.Againthisisadatabasecluster-widesetting,sosetitaccordingly.Inversion7.3.3andlater,thisparametershouldbesetcorrectlyasadefault.Inolderversions,bumpitupto300-1000.
3.5wal_buffers
ThissettingdecidesthenumberofbuffersWAL(WriteaheadLog)canhave.Ifyourdatabasehasmanywritetransactions,settingthisvaluebithigherthandefaultcouldresultbetterusageofdiskspace.Experimentanddecide.Agoodstartwouldbearound32-64correspondingto256-512Kmemory.
4Othertips
4.1Checkyourfilesystem
OnOSlikeLinux,whichoffersmultiplefilesystems,oneshouldbecarefulaboutchoosingtherightonefromaperformancepointofview.ThereisnoagreementbetweenPostgreSQLusersaboutwhichoneisbest.
Contrarytopopularbelief,today'sjournalingfilesystemsarenotnecessarilyslowercomparedtonon-journalingones.Ext2canbefasteronsomesetupsbuttherecoveryissuesgenerallymakeitsuseprohibitive.DifferentpeoplehavereportedwidelydifferentexperienceswiththespeedofExt3,ReiserFS,andXFS;quitepossiblythiskindofbenchmarkdependsonacombinationoffilesystem,disk/arrayconfiguration,OSversion,anddatabasetablesizeanddistribution.Assuch,youmaybebetteroffstickingwiththefilesystembestsupportedbyyourdistribution,suchasReiserFSforSuSELinuxorExt3forRedHatLinux,nottoforgetXFSknownforit'slargefilesupport.Ofcourse,ifyouhavetimetoruncomprehensivebenchmarks,wewouldbeinterestedinseeingtheresults!
责编:豆豆技术应用