AWS Redshift Serverless - 如何清空缓存以查看冷启动时间?

0

【以下的问题经过翻译处理】 在 Oracle 中,我可以使用 ALTER SYSTEM FLUSH SHARED_POOL; 命令清除现有数据并重新加载新数据。在 AWS Redshift 和 AWS Redshift Serverless 中是否有替代方法?

profile picture
EXPERT
asked 6 months ago57 views
1 Answer
0

【以下的回答经过翻译处理】 在Redshift和Serverless中,可以使用"alter database db_name result cache [on|off];"在数据库级别清除缓存,现有的结果将被刷新,可以通过系统表进行验证:

  1. Redshift Provisioned:select userid, query, elapsed, source_query from svl_qlog where userid > 1 order by query desc; 列source_query将具有缓存结果的查询ID
  2. Redshift Serverless:select user_id, query_id, elapsed_time, result_cache_hit, query_text from SYS_QUERY_HISTORY where user_id > 1 order by start_time desc; 列result_cache_hit将设置为true/false

一旦关闭缓存,它将清除所有缓存,并且在您设置为打开之前不会重新构建缓存。请注意,如果使用alter database命令,它不会清除群集级别的缓存(对于Provisioned)和实例级别的缓存(对于Serverless)。

您还可以在会话级别启用和禁用缓存。将enable_result_cache_for_session设置为[on|off];

参考资料: https://docs.aws.amazon.com/redshift/latest/dg/r_SVL_QLOG.html https://docs.aws.amazon.com/redshift/latest/dg/SYS_QUERY_HISTORY.html https://docs.aws.amazon.com/redshift/latest/dg/r_enable_result_cache_for_session.html

profile picture
EXPERT
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions