WITH Employee AS
( SELECT E.Com_Id,
Com.Sinl_ID CLASS.Details_ID,
Employee E
INNER JOIN employee_Det Det ON E.Com_ID=Det.Com_ID
INNER JOIN Employee_Sig Sig ON E.Com_ID=Sig.Main_Com_ID
INNER JOIN Emp_Sig_Det Com Sig.Com_ID=Com.Com_ID
INNER JOIN Employee_Class CLASS ON Com.F_ID=Class.Class_Id
******N*******
INNER JOIN Employee_AB_Class ABC ON E.Com_ID=AB.Main_Com_Id
INNER JOIN Emp_AB_Class_Sig ABC_Sig ON AB.COM_ID=ABC_SIG.COM_ID
INNER JOIN Employee_Class Class1 ABC_Sig.F_ID=Class1.Class_Id
WHERE Det.ODate='2015-01-01'
AND Sig.ODate='2015-01-01'
AND Com.ODate='2015-01-01'
AND Class.ODate='2015-01-01'
AND Abc.ODate='2015-01-01'
AND ABC_Sig.ODate='2015-01-01'
AND Class.ODate='2015-01-01'
AND ),
DEPT AS
( SELECT E.Com_Id,
Com.Sinl_ID CLASS.Details_ID,
DEPT E
INNER JOIN DEPT_Det Det ON E.Com_ID=Det.Com_ID
INNER JOIN DEPT_Sig Sig ON E.Com_ID=Sig.Main_Com_ID
INNER JOIN DEPT_Sig_Det Com Sig.Com_ID=Com.Com_ID
INNER JOIN DEPT_Class CLASS ON Com.F_ID=Class.Class_Id
******N*******
INNER JOIN DEPT_AB_Class ABC ON E.Com_ID=AB.Main_Com_Id
INNER JOIN DEPT_AB_Class_Sig ABC_Sig ON AB.COM_ID=ABC_SIG.COM_ID
INNER JOIN DEPT_Class Class1 ABC_Sig.F_ID=Class1.Class_Id
WHERE Det.ODate='2015-01-01'
AND Sig.ODate='2015-01-01'
AND Com.Date='2015-01-01'
AND Class.ODate='2015-01-01'
AND Abc.ODate='2015-01-01'
AND ABC_Sig.ODate='2015-01-01'
AND Class.ODate='2015-01-01'
AND ),
SELECT *
FROM Employee
UNION ALL
SELECT *
FROM DEPT;
以下表格的数量太大,无法处理 蜂巢,请您提示如何提高性能
员工人数
Det - 15 Million
Sig - 15 Million
Com - 10 Million
Class - 10 Million
Abc.ODate - 1000 Records
ABC_Sig -10 Million
Class.ODate- 10 Million
部门数
Det - 25 Million
Sig - 25 Million
Com -20 Million
Class - 20 Million
Abc.ODate - 1000 Records
ABC_Sig -50 Million
Class - 50 Million