我有10个表具有相同的列。像2011,2012 .. 2020
一样,我逐年制作了单独的数据。
我制作了一个视图,用于使用union all合并所有表数据。
create view as a combine
select * from table_2011
union all
select * from table_2012
..
union all
select * from table_2020;
现在,当我运行一些查询时,它需要9分钟才能归组。
select name, count(name) from combine group by name;
有人可以帮助我提高视线速度吗?我已经给所有表和列提供了索引。
将索引添加到视图的名称列中