您的位置:首页 > 数据库 > MySQL

Mysql物化视图应用

2012-03-13 16:34 120 查看
1、基本api

//第一步:创建物化视图

call flexviews.CREATE('demo',

'mv_company_sales_items_monthly',

'INCREMENTAL'

);

----------数据库、视图名称、刷新类型(增量刷新)

//获取视图id

select @mvid := last_insert_id();

//第二步:增加表,where条件用到

call flexviews.add_table(@mvid, 'demo', 'orders', 'o', 'USING(CustomerId)');

-----视图id,数据库名称、表名称、表别名,条件

v_mview_id - The materialized view id (see flexviews.get_id)

v_table_schema - The schema which contains the table to add
v_table_name - The name of the table to add
v_table_alias - The table alias to use in the view. All tables MUST have an alias.

v_join_clause - Every table after the first must have a NOT-NULL join clause
//第三部:

//第四部:物化视图

call flexviews.enable(@mvid);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: