Does Postgres provide a command to flush buffer cache?

你说的曾经没有我的故事 提交于 2019-12-01 08:31:56

问题


Hi Sometimes I need to do some SQL tuning task, I usually do such tests on my test db. After I excute a sql statments, I want to flush the buffer cache which containing SQL statements and sql result, just like the command in Oracle "Alter system flush buffer_cache"
Is PG server provide a commond of this?


回答1:


Check out this SO answer,

See and clear Postgres caches/buffers?




回答2:


If you're developing on OSX (I haven't tested on linux), you can use purge command to force disk cache to be purged (flushed and emptied). Then run your SQL query again and it should execute as if it were the first time.



来源:https://stackoverflow.com/questions/5101301/does-postgres-provide-a-command-to-flush-buffer-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!