如何在Redshift查询中禁用使用缓存结果?

问题描述:

我对在Redshift中对查询进行性能测试感兴趣.

I am interested in performance testing my query in Redshift.

我想禁止查询使用先前查询的任何缓存结果.换句话说,我希望查询从头开始运行.是否可以仅在执行查询时禁用缓存的结果?

I would like to disable the query from using any cached results from prior queries. In other words, I would like the query to run from scratch. Is it possible to disable cached results only for the execution of my query?

我不想禁用整个数据库/所有查询的缓存结果.

I would not like to disable cached results for the entire database/all queries.

SET enable_result_cache_for_session TO OFF;

来自 enable_result_cache_for_session-Amazon Redshift :

指定是否使用查询结果缓存.如果enable_result_cache_for_sessionon,则在提交查询时,Amazon Redshift将检查查询结果的有效缓存副本.如果在结果缓存中找到匹配项,则Amazon Redshift将使用缓存的结果,并且不会执行查询.如果enable_result_cache_for_sessionoff,则Amazon Redshift将忽略结果缓存并在提交所有查询时执行所有查询.

Specifies whether to use query results caching. If enable_result_cache_for_session is on, Amazon Redshift checks for a valid, cached copy of the query results when a query is submitted. If a match is found in the result cache, Amazon Redshift uses the cached results and doesn’t execute the query. If enable_result_cache_for_session is off, Amazon Redshift ignores the results cache and executes all queries when they are submitted.