DB2中是否可以设置MQT的自动刷新?
还有其他方法可以安排刷新吗?假设我想每 2 小时刷新一次 MQT。这可能吗?
例子:
CREATE TABLE MY_MQT (average, sum, max) as (
SELECT
avg(table1.field1) as average,
sum(table2.field2) as sum,
max(table3.field3) as max
FROM TABLE1, TABLE2, TABLE3
)
DATA INITIALLY DEFERRED
REFRESH DEFERRED
Is there any other way to schedule the refresh? Say I want to refresh the MQT every 2 hours. Is that possible?
Example:
CREATE TABLE MY_MQT (average, sum, max) as (
SELECT
avg(table1.field1) as average,
sum(table2.field2) as sum,
max(table3.field3) as max
FROM TABLE1, TABLE2, TABLE3
)
DATA INITIALLY DEFERRED
REFRESH DEFERRED
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用的是 DB2 9.7,则可以编写一个存储过程来处理刷新并使用 管理任务计划程序来执行它。或者,如果您想使用数据库之外的内容,请使用 cron 来安排它。
如果您需要如此频繁地刷新 MQT,您是否考虑过使用立即刷新 MQT 来完全避免这种维护?
If you are using DB2 9.7, you could write a stored procedure to handle the refresh and use the Administrative Task Scheduler to execute it. Or, use cron to schedule it, if you want to use something not inside the database.
If you are needing to refresh your MQT so frequently, have you considered using a refresh immediate MQT, to avoid this maintenance entirely?