6/13/2015 Visit the Sponsor tables to enter their end of day raffles. Turn in your completed Event Evaluation form at the end of the day in the Registration.

Slides:



Advertisements
Similar presentations
10 Things Not To Do With SQL SQLBits 7. Some things you shouldn’t do.
Advertisements

Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
Introduction to SQL Session 2 Retrieving Data From Multiple Tables.
Introduction to Structured Query Language (SQL)
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Tempdb Parasites Jason Hall-Dir. of Client SQL Sentry Blog-jasonhall.blogs.sqlsentry.net.
Introduction to Structured Query Language (SQL)
Overview What is SQL Server? Creating databases Administration Security Backup.
SQL Server 2008 Implementation and Maintenance Chapter 7: Performing Backups and Restores.
Chapter 10 : Designing a SQL Server 2005 Solution for High Availability MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
SQL and Support Debugging Tool Paul Johnson and Graham O’Bray.
Database Design for DNN Developers Sebastian Leupold.
Maintaining a Mirrored Database Tips and Tricks by Paul G. Hiles.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
Architecture Rajesh. Components of Database Engine.
Chokchai Junchey Microsoft Product Specialist Certified Technical Training Center.
Ashwani Roy Understanding Graphical Execution Plans Level 200.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
By Shanna Epstein IS 257 September 16, Cnet.com Provides information, tools, and advice to help customers decide what to buy and how to get the.
1 Chapter 10 Joins and Subqueries. 2 Joins & Subqueries Joins – Methods to combine data from multiple tables – Optimizer information can be limited based.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
T-SQL: Simple Changes That Go a Long Way DAVE ingeniousSQL.com linkedin.com/in/ingenioussql.
DBA 328 Designing for Performance: Optimization with Indexes Kimberly L. Tripp Solid Quality Learning – SolidQualityLearning.com
Database technology Introduction ER Modeling Database objects (intro) SQL.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 1: Introduction to IS2803 Rob Gleasure
SQL Server 2005 Implementation and Maintenance Chapter 6: Security and SQL Server 2005.
Query Execution Query compiler Execution engine Index/record mgr. Buffer manager Storage manager storage User/ Application Query update Query execution.
Sofia, Bulgaria | 9-10 October SQL Querying Tips & Techniques Richard Campbell.
Thinking in Sets and SQL Query Logical Processing.
Best Practices in Loading Large Datasets Asanka Padmakumara (BSc,MCTS) SQL Server Sri Lanka User Group Meeting Oct 2013.
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
Eugene Meidinger Execution Plans
6/13/2015 Visit the Sponsor tables to enter their end of day raffles. Turn in your completed Event Evaluation form at the end of the day in the Registration.
Scripting Just Enough SSIS to be Dangerous. 6/13/2015 Visit the Sponsor tables to enter their end of day raffles. Turn in your completed Event Evaluation.
How to kill SQL Server Performance Håkan Winther.
# CCNZ What is going on here???
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
BTM 382 Database Management Chapter 8 Advanced SQL Chitu Okoli Associate Professor in Business Technology Management John Molson School of Business, Concordia.
Using Structured Query Language (SQL) NCCS Applications –MS Access queries (“show SQL”) –SAS (PROC SQL) –MySQL (the new dataserver) –Visual Foxpro Other.
SQL Server 2016 – New Features Tilahun Endihnew March 12, 2016.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
Select Complex Queries Database Management Fundamentals LESSON 3.1b.
Jeremy Kingry, eBECS | ADVANCED SQL SERVER FOR ADMINS AND ANALYSTS.
IFS180 Intro. to Data Management Chapter 10 - Unions.
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
Top 50 SQL Interview Questions & Answers
Relational Database Design
Introduction to SQL 2016 Temporal Tables
UFC #1433 In-Memory tables 2014 vs 2016
T-SQL: Simple Changes That Go a Long Way
T-SQL: Simple Changes That Go a Long Way
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Contained DB? Did it do something wrong?
Introduction to SQL Server Management for the Non-DBA
The Ins and Outs of Partitioned Tables
Four Rules For Columnstore Query Performance
Database Administration for the Non-DBA
SQL Server May Let You Do It, But it Doesn’t Mean You Should
Dynamics AX Performance
Peter Shore SQL Saturday Cleveland 2016
Tally Ho! -- Explore the Varied Uses of Tally Tables
Four Rules For Columnstore Query Performance
Contents Preface I Introduction Lesson Objectives I-2
Chapter 8 Advanced SQL.
Chapter 11 Managing Databases with SQL Server 2000
All about Indexes Gail Shaw.
T-SQL: Simple Changes That Go a Long Way
Presentation transcript:

6/13/2015 Visit the Sponsor tables to enter their end of day raffles. Turn in your completed Event Evaluation form at the end of the day in the Registration area to be entered in additional drawings. Want more free training? Check out the Houston Area SQL Server User Group which meets on the 2 nd Tuesday of each month. Details at Thank You Sponsors!

SQL & Microsoft SQL Server for Builders of Software ( SQL Server - Tips, Tricks, and Other Good Stuff ) Dane Schilling Year Old Headspringer Sprung: 4/1/2014

You’re in good hands... ●6 years of report writing o Cognos, Crystal, and SSRS ●3 years of MS SQL Server Administration ●3 years of.NET Development ●Passionate about SQL ●Learning from new mistakes everyday

Agenda ●Things to check ●DR/HA ●T-SQL ●Goodies

●Google with keyword tsql ●Who to trust: Paul Randal, Kimberly Tripp, Brent Ozar..and others ●Great resource: ●It depends Oddities...

Things to check Really...please check these things

●Development and test databases should be in simple mode ●Databases should not be left in bulk-logged ●Don’t arbitrarily change recovery models o This will affect backups and behavior ●If not in simple mode you MUST take log backups Recovery Model

Two Gotchas... ●SQL Server 2012 bug (fixed in CU7) with model database ●RoundHouse bug (fixed in version 0.8.6) default to full mode

Database Maintenance Check that the following are occurring on some schedule (on all environments): ●Backups ●CHECKDB* ●Statistics Updates ●Index Maintenance ●History Cleanup

Security ●sa account should be disabled ●Best to use Windows authentication only ●Grant minimal rights* *Hard to do

Files At a minimum add at least one file; this at least separates the system data from your data. The more separation you have the more restoration options you have - it isn’t magic though.

Indexes ●Clustered = physical sort (only one allowed, avoid heaps) ●Others are non-clustered ●Double edged sword ●Foreign keys are not automatically indexed

Questions?

Disaster Recovery & High Availability These things are important to our stakeholders.

Disaster Recovery ●Backups are worthless if they can’t be restored...ask someone to restore one occasionally ●You cannot restore to a point in time in simple mode and sometimes not in bulk- logged

High Availability ●Ask stakeholders if they have any replicated DBs, mirrors or AlwaysOn systems in place...bad things can happen if you ignore their existence o High latency o Delayed log truncation (file growth) o Replication hell

AlwaysOn ●2012+ high availability option ●Super awesome o Multiple read replicas o Connection strings can be set to take advantage of read only replicas if available (ApplicationIntent) o Great for reporting

Questions?

T-SQL Microsoft’s blend of SQL

RBAR - Row By Agonizing Row When working with a database always leverage its ability to work with sets. If you find yourself trying to loop through rows then you are going about it the wrong way.

Joins ●List Tables Together o Join tables together in WHERE clause ●JOIN o Only returns matches ●INNER JOIN o Same as just JOIN ●FULL (FULL OUTER) JOIN o Returns all matches and all remaining non-matched rows ●LEFT (LEFT OUTER) JOIN o Returns all matches and all remaining rows from left source ●RIGHT (RIGHT OUTER) JOIN o Returns all matches and all remaining rows from right source ●CROSS JOIN o Returns all combinations (no on clause)

Gotcha

Temp tables, table variables and CTEs #Temp ●tempdb ●indexes ●connection ●memory ●primary key ●batch scope ; CTE ●different ●request

Working with Sets ●UNION ( ALL ) ●INTERSECT ●EXCEPT ●MERGE

Aggregates and Window Functions ●Aggregates o ROW_NUMBER() o RANK() o NTILE() o DENSE_RANK() o COUNT() o AVG() o etc…. ●Window Functions o OVER o PARTITION BY o ORDER BY o Can’t do COUNT(DISTINCT) o Don’t require GROUP BY (duplicates)

Subqueries ●Can be used in o SELECT o CASE o WINDOW FUNCTION o FROM o JOIN o WHERE o ORDER BY ●Can’t be used in o Aggregates o GROUP BY

Stored Procedures and Views ●Stored Procedures o Offer performance improvements o Accept parameters o Can’t be included with other queries o Code consistency and reusability ●Views o Don’t offer performance improvements (unless indexed) o Can be included in other queries o Code consistency and reusability

Functions ●Table and Scalar o Use with caution o Must be performant o Number of calls can be dramatic ●Table - Multi vs Single (Inline) ○Can be used with APPLY ■CROSS ■OUTER ●Scalar ○SELECT ○Clauses (ON and WHERE) ○ORDER BY ○GROUP BY

Questions?

Goodies!!! Now for some cool stuff???

CTE Trick Power of simple math!!!

4K Splitter...also from sqlservercentral.com

FOR XML PATH...I don’t remember where I saw this for the first time. I just know I love to abuse it.

Going a little crazy... You can use the XML CLR to build HTML!!!!!!!!!

Questions?