請查看我的示例查詢(下面給出),並讓我知道哪個查詢會更好地執行以及爲什麼。哪些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問題。 –