您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > SQL 培训 PPT
SQLDancyLeeSummaryTableIndexSARGStoreProcedureExecutionPlanSQL2000ArchitectureTablePrimaryKey.Alwayscreateaprimarykey.AvoidcreateprimarykeyonAttribute.NULLIndexIndexBasicClusteredIndexNon-ClusteredIndexIndexBasicAllSQLServerIndexesAreOrganizedAsB-Trees.MultipleIndexesCanBeUsedOnASingleTable.WithNoIndexes,ATableMustBeScanned.ClusteredIndexClusteredIndexDataorderbyClusteredIndexOnlyoneClusteredIndexinonetableTheleaflevelcontainsthedatapages.theclusteredkeyisduplicatedineverynon-clusteredindexrow.ClusteredIndexUniqueIfNon-Unique,RIDwillautoaddedNarrowStaticEver-increasingTheImpactofClusteredIndexChangeRecordRelocationEveryNon-ClusteredIndextobemodifiedCausepagesplitandfragmentationWasteTimeGoodClusteredIndexEver-IncreasingIdentitycolumn,IntorBigIntEver-IncreasingDatecolumnfollowedbyIdentitycolumnEver-IncreasingGUIDNon-ClusteredIndexNon-ClusteredIndexTheLeafLevelContainsaBookmark:ClusteredIndex.RID.EfficientWhenSearchingForASingleRow.95%performanceissuecanbefixedwithcorrectindex.Indexlikesalt.StoreProcedureASeriesofSQLstatements.Pre-compiled.Lownetworktraffic.SP_versusUSP_.SARG(SearchArgument)columnoperatorvalue.valueoperatorcolumn.Operatormustbeoneof=,,=,=.Somenon-SARGcanbeconverted.QueryOptimizationSELECT*versusSELECTcolumn1,column2,column3,….NeverreturnmoredatathatyoureallyneedUNIONversusUNIONALLLIKE‘%A’versusLIKE‘A%’DATEDIFF…ExecutionPlanTableScanIndexSeekClusteredIndexSeekClusteredIndexScan,aslikeTableScanPhysicaloperation:Thisistheoperatorusedbythequeryoptimizerforthisstep.Oneexamplewouldbeanestedloop.Logicaloperation:Isusuallythesameasthephysicaloperator.Whendifferent,thisrepresentsakeywordinthequery.OneexamplewouldbeINNERJOIN.Rowcount:Thisisthenumberofrowsfetchedbythisstepandpassedtothenextstep.Estimatedrowsize:Thisistheestimatedrowsizepassedontothenextstep.I/Ocost:ThisistheestimatedcostforallI/Oactivityforastep.Thelowerthisnumberisthebetter.CPUcost:ThisistheestimatedcostforallCPUactivity.Numberofexecutes:Isthenumberoftimesthestepwasexecuted.Cost:Isthecostforthestepbeingviewed.Thelowerthisnumberisthebetter.Subtreecost:Isthecostofthestepbeingviewedandallprevioussteps.SQLProfilerBooksOnline
三七文档所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
本文标题:SQL 培训 PPT
链接地址:https://www.777doc.com/doc-3381991 .html