Mysql物化视图应用
时间:2015-10-10 11:28 来源:linux.it.net.cn 作者:IT
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);
(责任编辑:IT)
1、基本api //第一步:创建物化视图
call flexviews.CREATE('demo', ----------数据库、视图名称、刷新类型(增量刷新)
//获取视图id select @mvid := last_insert_id(); //第二步:增加表,where条件用到 call flexviews.add_table(@mvid, 'demo', 'orders', 'o', 'USING(CustomerId)'); -----视图id,数据库名称、表名称、表别名,条件
|