Reputation: 22925
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: this question
See and clear Postgres caches/buffers?
seems to say that the answer is "no", although it is now two years old. Are there any relevant changes in postgresql 9.0?
Upvotes: 12
Views: 13999
Reputation: 63596
The two things you've stated are not at all equivalent.
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.
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).
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/ )
Upvotes: 10