14 November,2019 by Rambler
Question: In SQL Server there are two commands which clear down the data and query caches - DBCC FREEPROCCACHE and DBCC DROPCLEANBUFFERS. Are there similar commands in PostgreSQL hosted on Linux? I want to clear down datasets from memory cache to allow query performance tuning.
Answer: If you'd like to view what is in the buffer cache - pg_buffercache will present to you what is in the cache. Of course , pg_buffercache needs to be installed. It's a complicated data set and requires some knowledge to interpret. Unfortunately - there isn't a straightforward way of clearing down the database cache and query plans - similar to SQL Server.
I use a fairly basic method of Stopping postgresql , use the drop_caches module , start Postgresql. The drop_caches Linux module only frees up objects which are completely unused. This is the reason I stop Postgresql , as it will free up the dirty objects and make them freeable.
An example on a RHEL server is :
service postgresql stop;
/proc/sys/vm/drop_caches;
service postgresql start;
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |