哪些SQL查询会有更好的性能?
问题描述:
请查看我的示例查询(下面给出),并让我知道哪个查询会更好地执行以及为什么。哪些SQL查询会有更好的性能?
方法1:
select team_id,grp_name,grp_desc from
(
select distinct team_id,grp_name,grp_desc from team_table tt where .....
UNION
select team_id,grp_name,grp_desc from sec_team_table stt where ....
UNION
select team_id,grp_name,grp_desc from ter_team_table ttt where...
)
方法2:
select distinct team_id,grp_name,grp_desc from team_table tt where .....
UNION
select team_id,grp_name,grp_desc from sec_team_table stt where ....
UNION
select team_id,grp_name,grp_desc from ter_team_table ttt where...
感谢
考虑http://dba.stackexchange.com/用于SQL问题。 –