PostgreSQL的SQL_NO_CACHE吗? [英] SQL_NO_CACHE for Postgresql?

查看:487
本文介绍了PostgreSQL的SQL_NO_CACHE吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在与MySQL关键字 SQL_NO_CACHE (或SQL Server dbcc删除清理缓冲区)等效的PostgreSQL,即您可以将其简单地包含在SQL语句中还是作为脚本的一部分?

Is there a postgresql equivalent for the MySQL keyword SQL_NO_CACHE (or the SQL Server dbcc drop clean buffers) i.e. which you can simply include in a SQL statement or as part of a script?

UPDATE :这个问题

查看并清除Postgres缓存/缓冲区吗?

似乎说答案是否,尽管它已经两年了。 PostgreSQL 9.0是否有任何相关更改?

seems to say that the answer is "no", although it is now two years old. Are there any relevant changes in postgresql 9.0?

推荐答案

您所说的两件事根本不相等。

The two things you've stated are not at all equivalent.

MySQL的SQL_NO_CACHE不会阻止引擎使用缓存的数据。这意味着查询未缓存在MySQL 查询缓存中。

MySQL's SQL_NO_CACHE does NOT stop the engine from using cached data. It means that the query is not cached in the MySQL query cache.

查询缓存与引擎可能使用的任何磁盘缓存都不相同之所以这样,是因为它缓存查询结果,而不是缓存磁盘(或表中的行等)中的数据块。因此,它会缓存文本语句的结果。

The query cache is not the same as any disc cache the engine might have because it caches the results of queries, not blocks from the disc (or rows from a table etc). So it caches the results of a text statement.

使用SQL_NO_CACHE的原因是您知道自己将执行不常用的查询,该查询返回了很多信息数据(因此会在缓存中占用大量空间)。

The reason for using SQL_NO_CACHE is that you know you're going to be doing an infrequently-used query which returns a lot of data (hence would take up a lot of space in the cache).

但是现在建议大多数MySQL安装关闭查询缓存以为页面腾出更多内存缓存等(请参见 http://dom.as/tech/query-cache-tuner/

But most MySQL installations are now advised to turn the query cache off to make more memory for page caches etc (see http://dom.as/tech/query-cache-tuner/ )

这篇关于PostgreSQL的SQL_NO_CACHE吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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