Your SlideShare is downloading. ×
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
You Can Tune Your Own SQL Code
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

You Can Tune Your Own SQL Code

1,251

Published on

Slide deck from a talk first delivered at SQL Saturday 34 in Waltham, MA. Mike Walsh talks about how you can tune your own SQL Server code. Walk through indexes, Query Plans, IO Statistics and …

Slide deck from a talk first delivered at SQL Saturday 34 in Waltham, MA. Mike Walsh talks about how you can tune your own SQL Server code. Walk through indexes, Query Plans, IO Statistics and Profiler. The goal was to show developers how painless it is to gauge performance and make changes as a result.

Updated to v1.5 as presented in Charlotte to SQLSat33

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,251
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
30
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. You Can Tune Your Own Code
    SQL Saturday #33 Charlotte
  • 2. Who Is Mike?
    10 years with SQL
    DBA roles of various sorts
    Blog: www.straightpathsql.com/
    Syndicated at SQLServerPedia
    Full Time – Principal DBA at global insurance company.
    “Spare” Time – Consult for SQL Administration and Performance Issues
    President of new “Seacoast SQL” PASS Chapter
  • 3. Who Are You?
  • 4. “Why is this so slow?!”
    “It worked fine in dev!”
    “The results came back fine… I’m done”
  • 5. What Aren’t We Covering?
  • 6. “Can’t you
    just make it
    faster?!”
    http://www.flickr.com/photos/irinaslutsky/4000761728/
  • 7. www.flickr.com/photos/no3rdw/170950846/
  • 8. http://www.flickr.com/photos/dullhunk/359634390/
    www.flickr.com/photos/no3rdw/170950846/
  • 9. Agenda
    • Tips For Slow Queries
    • 10. The Right Mindset & Some Best Practices
    • 11. Indexes & Statistics (Building Blocks)
    • 12. Query Plans (Not So Scary)
    • 13. SQL Profiler (Don’t tell my DBA friends..)
    • 14. Put it all together and CLAP
    • 15. DBAs don’t mean to be so mean*
    *Maybe we do…, but let’s work it out
  • 16. Goal 1
    You will leave using the concepts we discuss.
  • 17. Goal 2
    You won’t ever say, “done” until you know your code
    PERFORMS
  • 18. Goal 3
    “Can’t we all just get along??!”
  • 19. Tips For Making Queries Slow
  • 20.
  • 21. Right Mindset
  • 22. Right Mindset
    • SQL Is Declarative
    • 23. Work With Sets
    • 24. Watch Transaction Footprint
    • 25. Join Where Necessary
    • 26. Remember: Disk – Memory – Query
    • 27. Smaller Sets ASAP
    • 28. Work with the columns you need
  • “Should I split this up?”
    “Should I use -that- view?”
    “How Many Reads Am I doing?”
    “What will happen in 1 year?”
    “How many rows are affected by that operation?”
  • 29. How Are You Proving Your Code?
    • Working with representative volume?
    • 30. Testing various scenarios?
    • 31. Before/After Testing?
    • 32. Using Empirical Evidence?
    • 33. Look and Feel with a Stop Watch???
  • Indexes
  • 34. What Are Indexes?
    • Pointers To Data
    • 35. B-Tree Structures
    • 36. Sometimes – Hero Makers
    • 37. Sometimes – Frustrations
  • Clustered Indexes
  • Non-Clustered Indexes
    • Leaf Level Has Index Data and Pointer Only
    • 42. Joins
    • 43. Common (and Selective) Search Criteria.
  • What Does It All Mean?
    Scan
    Seek
    “Bookmark/RID/KEY Lookups”
    Covering
  • 44. Statistics
  • 45. SARGable Queries
  • 46. Search ARGuments
    • Query That Can Use An Index
    • 47. (All Things Being Equal…)
    • 48. Generally: =, <, >, <=, =>, BETWEEN, IN, LIKE (with exceptions).
    • 49. Some Rules but think of the phonebook…
  • Fun(?) With Phonebooks
  • 50. Some Tools
  • Put It Together
    Care
    Look
    Act
    Prove It Out
  • 53. http://www.flickr.com/photos/hikingartist/3515471358/
  • 54. Goal 3
    “Can’t we all just get along??!”
  • 55. Goal 1
    You will leave using the concepts we discuss.
  • 56. Goal 2
    You won’t ever say, “done” until you know your code
    PERFORMS
  • 57. You CAN Tune Your Own SQL Code
  • 58. Resources
    • mike@StraightPathSQL.com
    • 59. www.SQLServerCentral.com
    • 60. www.SQLServerPedia.com
    • 61. sqlblog.com
    • 62. blogs.msdn.com/craigfr/default.aspx
    • 63. http://sqlinthewild.co.za/
    • 64. http://scarydba.wordpress.com/
    • 65. http://www.straightpathsql.com/blogroll/
  • 66.
  • 67.
  • 68. StraightPathSQL.com/ucandoit
  • 69. Confused?
    Angry?
    Lost?

×