37
Tips & Tricks with SQL Server Performance Tuning, SSRS, SSIS, and More! By Ike Ellis, MVP @ike_ellis www.ikeellis.com Blog.ikeellis.com http:// www.linkedin.com/in/ikeellis Look for CraftingBytes – Coming Soon DevelopMentor SQL Pass Book Readers

SQL Pass Architecture SQL Tips & Tricks

Embed Size (px)

DESCRIPTION

Tips & Tricks session Delivered on Jan 30, 2014 for the SQL Pass Architecture Group.

Citation preview

Page 1: SQL Pass Architecture SQL Tips & Tricks

Tips & Tricks with SQL Server Performance Tuning, SSRS, SSIS, and More!

By Ike Ellis, MVP@ike_elliswww.ikeellis.comBlog.ikeellis.comhttp://www.linkedin.com/in/ikeellisLook for CraftingBytes – Coming SoonDevelopMentorSQL Pass Book Readers

Page 2: SQL Pass Architecture SQL Tips & Tricks

2

Page 3: SQL Pass Architecture SQL Tips & Tricks

So you want to be great at SQL Server…SQL Server Integration ServicesSQL Server Analysis Services

TabularMultiDimensional

SQL Server Reporting ServicesExcelData Quality ServicesService BrokerPerformance Tuning

IndexingQuery PlansPlan AnalysisMemory ManagementSANsNetwork

ClusteringAvailability GroupsPowerShellMaster Data ServicesArchitectureData Mart DesignData NormalizationCDCNoSQL/BigData (At least the MS Cloud Offerings)Competitive Knowledge (Oracle, Tablaeu, QlickView, Postgres)ORMs(Entity Framework, Nhibernate, Micros)Installation/Configuration/Upgrading/Service Packing

Power BIPowerMapPowerQueryPowerView

PowerPivotT-SQL

QueryingStored ProceduresFunctionsWindowing FunctionsAggregates

CLRMDXDAXXMLABCPSQL AzureTooling

RedgateSSMSSSDT

Past VersionsCentral ManagementDacPacs/BacPacsProfiler/Extended EventsAuditingSecurity/EncryptionReplicationSQLCMD

Page 4: SQL Pass Architecture SQL Tips & Tricks

Tips From the SQL Consultant

For the YouTube/Reddit/Chive/Cracked/Meme generationLots of disjointed tipsPopular mistakes I see or easy things I think you can take advantage ofBetween 3 – 5 minutes eachLet’s see if we can get through all 20

Page 5: SQL Pass Architecture SQL Tips & Tricks

Tip #1: SSIS for the Color Blind

Page 6: SQL Pass Architecture SQL Tips & Tricks

Tip #2: Five minutes on report formatting = 10x more impressive

Spend 10 minutes on design (as opposed to the zero we typically spend)     Choose colors wisely     • 99/100 - developers use the default color palette        

HTML color picker websites  • http://www.lavishbootstrap.com   

MorgueFile• http://www.morguefile.com/

Page 7: SQL Pass Architecture SQL Tips & Tricks

7

Life Tip: Start 2014 with a jar and fill it with notes of good things that happenNext New Year’s Eve, empty the jar and see what awesome stuff happened that year.

Page 8: SQL Pass Architecture SQL Tips & Tricks

Tip #3: The right way to find hardware problems

Merging PerfMon and TracingGet the Batch and Completed Events OnlyNever trace from the computer you are monitoringAlways trace to a file and then load in a table after.

8

*Thanks, Grant!

Page 9: SQL Pass Architecture SQL Tips & Tricks

Tip #4: Lifehack: Readable Presentations

Take the average age of the people in your audience and divide by 2: That’s your font size

USE THIS SIZE IF YOUR AUDIENCE IS 200

Page 10: SQL Pass Architecture SQL Tips & Tricks

Tip #5: Check for heaps/clustered indexes

SELECT t.[Name] FROM sys.Indexes i JOIN sys.Tables t ON t.Object_ID = i.Object_idWHERE i.type_desc = 'HEAP'ORDER BY t.[Name]

Page 11: SQL Pass Architecture SQL Tips & Tricks

Tip #6: The proper way to run an SSIS package

Page 12: SQL Pass Architecture SQL Tips & Tricks

12

Tip: More Visualization Tips

Page 13: SQL Pass Architecture SQL Tips & Tricks

13

In nature, colors do two things:

1) Entice2) Warn

So let’s use them sparingly..

Page 14: SQL Pass Architecture SQL Tips & Tricks

14

Stephen Few Dashboard

Page 15: SQL Pass Architecture SQL Tips & Tricks

15

Tip: ColorBrewer

Cynthia Brewer did a fantastic job!

Page 16: SQL Pass Architecture SQL Tips & Tricks

Tip #7: No reason to use ISNULL CONCAT!

Messy vs clean codeNo + symbol neededNo ISNULL needed

Page 17: SQL Pass Architecture SQL Tips & Tricks

17

Life Tip: If you backpack, but need news, search Wikipedia by month & year

Page 18: SQL Pass Architecture SQL Tips & Tricks

Tip #8: How to search schema

F7SQLSearch• Free• Download it!• http://www.red-gate.com/products/sql-development/sql-search/• Did I mention it’s free?

Dependency Tracker• Not Free, but still cool

select object_name(object_id), definition as namefrom sys.all_sql_moduleswhere definition like '%cust%'

*THANKS HUGO!

Page 19: SQL Pass Architecture SQL Tips & Tricks

Tip #9: Windowing Functions are pretty cool

They are worth learning, and have a neat evolution

Page 20: SQL Pass Architecture SQL Tips & Tricks

Tip #10: SSDT Search for options

No more digging around in optionsJust search for everything

Page 21: SQL Pass Architecture SQL Tips & Tricks

21

Presentation Tip

Page 22: SQL Pass Architecture SQL Tips & Tricks

Tip #11: Scripting: You have two choices

Two Choices• Get good at boring repetitive tasks• Get good at PowerShell & Scripting

Who adds more value to their company or their customers?Who gets paid more?

Page 23: SQL Pass Architecture SQL Tips & Tricks

Tip #12: TempDB Configuration

Current thought is 4 logical processors to 1 fileJust a good beginning, your mileage may veryStart there, then go to 2:1 or 1:1 if necessaryTrace Flag 1117 or autogrow off

Page 24: SQL Pass Architecture SQL Tips & Tricks

24

Travel Tip: If you take a power strip to the air port during the winter, you’ll be a hero

Page 25: SQL Pass Architecture SQL Tips & Tricks

Tip #13: Prettify!

25

http://extras.sqlservercentral.com/prettifier/prettifier.aspx

RedGate PlugIn for SQL Server Management Studio

Page 26: SQL Pass Architecture SQL Tips & Tricks

Tip #14: Execute scripts over multiple servers?

Super easy!

Page 27: SQL Pass Architecture SQL Tips & Tricks

Tip #15: Life is so easy with a dates table

Find the sales numbers for the first Monday of every month of the yearT-SQL with no dates tableT-SQL with dates table

Page 28: SQL Pass Architecture SQL Tips & Tricks

28

Life Tip: Motorcyclist signaling cop to other motorcyclist

Page 29: SQL Pass Architecture SQL Tips & Tricks

Tip #16: Try_Cast

Avoiding terrible casting errors

Page 30: SQL Pass Architecture SQL Tips & Tricks

Tip #17: Never reinvent the wheel

Take SQL# for exampleGood DocumentationEasy SyntaxCheap (and much of it is free)

Page 31: SQL Pass Architecture SQL Tips & Tricks

Tip #18: Save scripts for easy access

Lots of repetitive scripts with business logicNo reason to write the same queries for the same tables day after day

Page 32: SQL Pass Architecture SQL Tips & Tricks

32

Life Tip: Focus!

Page 33: SQL Pass Architecture SQL Tips & Tricks

Tip #19: Enforce Business Rules in the DB

Foreign KeysUnique ConstraintsCheck Constraints

33

Page 34: SQL Pass Architecture SQL Tips & Tricks

Tip #20: Log, Log, Log (and beware of subscriptions)

select c.Name, e.InstanceName, e.UserName, e.Parameters, e.TimeStart, e.TimeEnd, e.TimeDataRetrieval, e.TimeProcessing, e.TimeRenderingfrom executionlog e join catalog c on e.reportid = c.ItemID

Send a Link, or a file on a shared folder that you can audit. Find someway to audit who opened the link or the file in the folder. Try to avoid sending the PDF without a way to audit it.

Page 35: SQL Pass Architecture SQL Tips & Tricks

35

SQL Sentry Plan Explorer

Page 36: SQL Pass Architecture SQL Tips & Tricks

Ike Ellis

http://blog.ikeellis.comhttp://www.ikeellis.comYouTube • http://www.youtube.com/user/IkeEllisData

SQL Pass Book Readers • http://bookreaders.sqlpass.org/

San Diego Tech Immersion GroupTwitter: @ike_ellis619.922.9801Email address is just my first name @ikeellis.com

Page 37: SQL Pass Architecture SQL Tips & Tricks

Stay Involved!

• Sign up for a free membership today at sqlpass.org

• Linked In: Professional Association for SQL Server• Facebook: Professional Association for SQL Server Group• Twitter: @SQLPASS• The PASS Blog: sqlpass.org