用union all建立的视图应该是可以建立索引的吧?
select id, userid, description from table1
union all
select id, userid, description from table2
union all
select id, userid, description from table3
....
union all
select id, userid, description from table16
现在的视图是:
select id, userid, description from table1
union
select id, userid, description from table2
union
select id, userid, description from table3
....
union
select id, userid, description from table16
这样的视图是不能建索引的。
所以怀疑起不到性能提升的作用,反倒跟单表操作没什么区别了。