|
多个表进行union all 进行查询,速度慢, union all 的表有几十个,试了选几个表生成一个视图,发现查询速度很慢。
例如:
create or replace view sb_all as
select dzxh, aa, bb,cc ,dd ,ee ,ff
from t1
union all
select dzxh, aa, bb,cc ,dd ,ee ,ff
from t2
union all
select dzxh, aa, bb,cc ,dd ,ee ,ff
from t3
union all
select dzxh, aa, bb,cc ,dd ,ee ,ff
from t4
union all
...
select dzxh, aa, bb,cc ,dd ,ee ,ff
from t40
union all
上述的表结构不一样,抽取一些公用的数据建立一个视图,每个表的dzxh都有索引
select * from sb_all t where t.dzxh = '123456' 发现速度很慢,单个速度查询速度挺快的。
,
有什么办法提高查询速度。
|
|