【探讨】索引视图如何提高性能
2010-01-25 00:00:00 来源:WEB开发网2、 优化后的视图(执行select * from Query_NoEmployRegist用时98s)
代码
1 SET ANSI_NULLS on
2 GO
3 SET QUOTED_IDENTIFIER on
4 GO
5 ALTER VIEW [dbo].[Query_NoEmployRegist]
6 AS
7 SELECT
8 dbo.Person_BasicInfo.PersonID,
9 dbo.Person_BasicInfo.IdentityID,
10 dbo.Person_BasicInfo.Name,
11 dbo.Person_BasicInfo.Sex,
12 dbo.Person_BasicInfo.Folk,
13 dbo.Person_BasicInfo.Politics,
14 dbo.Person_BasicInfo.Birthday,
15 dbo.Person_BasicInfo.StudentSource,
16 dbo.Person_BasicInfo.StudentSourceCode,
17 dbo.Person_BasicInfo.EduLevel,
18 dbo.Person_BasicInfo.EduLevelCode,
19 dbo.Person_BasicInfo.EduNumber,
20 dbo.Person_BasicInfo.Stature,
21 dbo.Person_BasicInfo.Avoirdupois,
22 dbo.Person_BasicInfo.MarriageStatus,
23 dbo.Person_BasicInfo.College,
24 dbo.Person_BasicInfo.GraduatedDate,
25 dbo.Person_BasicInfo.Train,
26 dbo.Person_BasicInfo.Major,
27 dbo.Person_BasicInfo.Degree,
28 dbo.Person_BasicInfo.DegreeCertificate,
29 dbo.Person_BasicInfo.StudyMode,
30 dbo.Graduater_GraduaterRegist.RegistNO AS RegistNO,
31 dbo.Graduater_GraduaterRegist.RegistTime AS BaoDaoTime,
32 dbo.Graduater_GraduaterRegist.RegistMan AS RegistMan,
33 dbo.Graduater_Business.ComeFrom AS ComeFrom,
34 dbo.Graduater_Business.Code AS Code, dbo.Graduater_Business.Status AS Status,
35 dbo.Graduater_Business.ApproveResult AS ApproveResult,
36 dbo.Graduater_Business.NewCorp AS NewCorp,
37 dbo.Graduater_Business.CommendNumber AS CommendNumber,
38 dbo.Graduater_Business.EmployStatus AS EmployStatus,
39 dbo.Graduater_Business.NewCommendTime AS NewCommendTime,
40 dbo.Graduater_Business.GetSource AS GetSource,
41 dbo.Graduater_Business.EmployTime AS EmployTime,
42 dbo.Graduater_Business.Job AS Job, dbo.Graduater_Business.FillMan AS FillMan,
43 dbo.Graduater_Business.FillTime AS FillTime,
44 dbo.Graduater_Business.IsCommendOK AS IsCommendOK,
45 dbo.Graduater_Business.ApproveUser AS ApproveUser,
46 dbo.Graduater_Business.ApproveTime AS ApproveTime,
47 dbo.Graduater_Business.RegistTime AS RegistTime,
48 dbo.Graduater_Business.EmployCorp AS EmployCorp,
49 dbo.Graduater_Business.JobRemark AS JobRemark,
54 dbo.Person_Contact.Address AS Address, dbo.Person_Contact.Zip AS Zip,
55 dbo.Person_Contact.Telephone AS Telephone, dbo.Person_Contact.Mobile AS Mobile,
56 dbo.Person_Contact.Email AS Email, dbo.Person_Contact.IM AS IM,
57 dbo.Person_Skill.ForeignLanguage AS ForeignLanguage,
58 dbo.Person_Skill.ForeignLanguageLevel AS ForeignLanguageLevel,
59 dbo.Person_Skill.CantoneseLevel AS CantoneseLevel,
60 dbo.Person_Skill.MandarinLevel AS MandarinLevel,
61 dbo.Person_Skill.Language AS Language,
62 dbo.Person_Skill.TechnicalTitle AS TechnicalTitle,
63 dbo.Person_Skill.ComputerLevel AS ComputerLevel,
64 dbo.Person_EmployPurpose.JobType AS JobType,
65 dbo.Person_EmployPurpose.Vocation AS Vocation,
66 dbo.Person_EmployPurpose.JobPlace AS JobPlace,
67 dbo.Person_EmployPurpose.Salary AS Salary,
68 dbo.Person_EmployPurpose.OnJobDate AS OnJobDate,
69 dbo.Person_EmployPurpose.CorpType AS CorpType,
72 dbo.Graduater_Business.EmployType AS EmployType,
73 dbo.Graduater_Business.EmployTypeCode AS EmployTypeCode,
74 dbo.Graduater_Business.EmployCorpType AS EmployCorpType,
79 FROM dbo.Person_BasicInfo INNER JOIN
80 dbo.Graduater_Business ON
81 dbo.Person_BasicInfo.PersonID = dbo.Graduater_Business.PersonID LEFT OUTER JOIN
82 dbo.Graduater_GraduaterRegist ON
83 dbo.Graduater_Business.GradBusinessID = dbo.Graduater_GraduaterRegist.GraduaterGUID
84 INNER JOIN
85 dbo.Person_Contact ON
86 dbo.Person_BasicInfo.PersonID = dbo.Person_Contact.PersonID INNER JOIN
87 dbo.Person_Skill ON
88 dbo.Person_BasicInfo.PersonID = dbo.Person_Skill.PersonID INNER JOIN
89 dbo.Person_EmployPurpose ON
90 dbo.Person_BasicInfo.PersonID = dbo.Person_EmployPurpose.PersonID
91 GO
92 SET ANSI_NULLS OFF
93 GO
94 SET QUOTED_IDENTIFIER OFF
95 GO
更多精彩
赞助商链接