Postgres是否提供刷新缓冲区缓存的命令? [英] Does Postgres provide a command to flush buffer cache?

查看:94
本文介绍了Postgres是否提供刷新缓冲区缓存的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


有时我需要执行一些SQL调优任务,通常我会在测试数据库上进行此类测试。
执行完sql语句后,我想刷新包含SQL
语句和sql结果的缓冲区高速缓存,就像Oracle中的命令 Alter system flush buffer_cache

是PG服务器提供了这一点吗?

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?

推荐答案

如果您在OSX上进行开发(我尚未在Linux上进行测试),您可以使用 purge 命令强制清除(清空并清空)磁盘缓存。然后再次运行您的SQL查询,它应该像第一次一样执行。

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.

这篇关于Postgres是否提供刷新缓冲区缓存的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆