Your SlideShare is downloading. ×
0
SQL Server 2005 – Reading and Interpreting Query Plans<br />Florin Cardaşim<br />Lead developer<br />RomSoft, IAŞI,http://...
Agenda<br /><ul><li>Graphic, Xml and Text query plans
One-table SELECT
Table Join SELECT
INSERT, UPDATE, DELETE</li></li></ul><li>Sql Server Architecture<br />http://en.wikipedia.org/wiki/Microsoft_SQL_Server<br />
Demo<br />The tools:<br /><ul><li>Management Studio
Server Profiler
Upcoming SlideShare
Loading in...5
×

Sql Server execution plans

426

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
426
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Startamdiscutia cu imaginea care descriearhitectura SQL Server. Din multitudinea de componente ne indreptamatentiacatre Query Engine(Processor) si Storage Engine. Pescurt, Query Engine ia in primire un statement SQL, ilparseazasi in urmaunoranalize produce ceeace se numeste Query Plan.Acest plan estetrimis (in format binar) la Storage Engine care esteresposnsabil cu accesulfizic la date. Discutia de astazi se limiteaza la Query Engine sioutputulacestuia Query Plan. Vomintelegeimpreunaceeste un Query plan, cum se poateobtine, citisiinterpreta.
  • Scopulunui Query Plan esteacela de a descoperipasiiprin care rezolva query-ulcu un consum minimum de apeluri de I/O (disk) si CPU. Cost-based plan.Serverulcreazamaimulte Query Planurisi decide pe care ilutilizeazasianumepecel cu costul minim.Serverulmentinestatisticidespredistributiasiselectivitatea (unicitatea) valorilor din coloanesiindecsi.Implicit, statisticile se mentin automat la fiecare insert, update, joinsiasamaideparte.Planulestepasatcatre Storage Engine, care ilexecuta. E posibil ca planulsa nu fie respectatde Storage Engine in cazul in care statisticile nu maisuntactuale in momentulefectiv al rularii.Planul actual siplanulestimatcelestimatestecalculatfara a rulaefectiv query-ul, cidoarpebazastatisticilorcel actual esteplanulutilizat la rularea query-uluiPlanul actual poatediferi de celestimat, in principal din doua motive: statisticilesuntincorecte (in timpelesuntalterate un urmaoperatiunilor de insert, update, delete) sau e vorba de planuri care utilizeazaparalelismsi care la momentulrulariidecid ca paraelismul nu se maipoateefectua din motive cum arfilipsamemorieisau a threadurilorlibere.Planurile de executiesunt cache-uite cu scopul de a fireutilizate. Cum crearea un pan esteO operatiecostisitoare, intr-un sistem in care se ajunge la o bunareutilizare a planurilor, se obtincastiguriconsiderabile de performanta. Exista o schema de imbatranire a planurilor deexecutiepebazacareiaplanurilesuntscoasetreptat din cache (pentru a nu se consumainutilmemorie)DBCC FREEPROCACHE – curata cache-ul, util la testare
  • Cum se vizualizeazaplanulestimatsicel actual in format Text, XML siGraficCum se automatizeazaproducerea de planurifolosind Profiler; cum se salveaza un plan XML pentru a fireutilizatmaitarziuCum se foloseste Tuning Advisor;.trc, .sql
  • Transcript of "Sql Server execution plans"

    1. 1. SQL Server 2005 – Reading and Interpreting Query Plans<br />Florin Cardaşim<br />Lead developer<br />RomSoft, IAŞI,http://www.rms.ro <br />
    2. 2.
    3. 3. Agenda<br /><ul><li>Graphic, Xml and Text query plans
    4. 4. One-table SELECT
    5. 5. Table Join SELECT
    6. 6. INSERT, UPDATE, DELETE</li></li></ul><li>Sql Server Architecture<br />http://en.wikipedia.org/wiki/Microsoft_SQL_Server<br />
    7. 7.
    8. 8. Demo<br />The tools:<br /><ul><li>Management Studio
    9. 9. Server Profiler
    10. 10. Tuning Advisor</li></ul>Execution plans representations:<br /><ul><li>Text (SHOWPLAN_ALL, SHOWPLAN_TEXT, STATISTICS PROFILE)
    11. 11. XML (SHOWPLAN_XML, STATISTICS XML)
    12. 12. Graphical</li></li></ul><li>Clustered index: stores the data along with the lookup values of the index and sorts the data physically; implemented as B-tree(balanced)<br />Non-clustered index: sorts the columns included in the index, but it doesn’t sorts the data<br />
    13. 13. Q&A<br />
    14. 14. Thank you!<br />Florin Cardaşim<br />Lead developer<br />RomSoft, IAŞI,http://www.rms.ro <br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×