This document provides 25 tips for SQL Server performance tuning, SSIS, SSRS, SSAS and other Microsoft data tools. The tips cover topics like query shortcuts, code snippets, report formatting, finding hardware problems, windowing functions, TempDB configuration, dates tables, and more. The document is authored by Ike Ellis, an MVP, blogger and YouTube content creator focused on SQL Server and related Microsoft data tools.
Building Codealike: a journey into the developers analytics worldOren Eini
Codealike plugins in Visual Studio, Eclipse and Chrome, track developers while they code and perform analytic calculations at the millisecond level. For such write heavy workloads and using RavenDB as the main and only database was not without challenge. In this talk, we will reveal how we built and scaled such a solution, how we were able to improve performance with Voron and glance at our own mistakes and architectural choices down the line.
Building Codealike: a journey into the developers analytics worldOren Eini
Codealike plugins in Visual Studio, Eclipse and Chrome, track developers while they code and perform analytic calculations at the millisecond level. For such write heavy workloads and using RavenDB as the main and only database was not without challenge. In this talk, we will reveal how we built and scaled such a solution, how we were able to improve performance with Voron and glance at our own mistakes and architectural choices down the line.
Know thy cost (or where performance problems lurk)Oren Eini
Performance happens. Whether you're designed for it or not it doesn’t matter, she is always invited to the party (and you better find her in a good mood). Knowing the cost of every operation, and how it distributes on every subsystem will ensure that when you are building that proof-of-concept (that always ends up in production) or designing the latest’s enterprise-grade application; you will know where those pesky performance bugs like to inhabit. In this session, we will go deep into the inner working of every performance sensitive subsystem. From the relative safety of the client to the binary world of Voron.
Если раньше при старте нового проекта нам нужно было выбрать одну из доступных на тот момент SQL баз данных, то за последние 5 лет ситуация кардинально изменилась. Теперь выбор стал гораздо сложнее. SQL или NoSQL? Сloud или on-premises? Если SQL/NoSQL - то какая именно? А может использовать и то и другое?
В данном докладе мы постараемся представить общий обзор доступных сегодня решений для хранения данных и определиться с критериями выбора.
When we talk about “knowing our data,” we don’t seem to refer to the term “data integrity” anymore as part of that conversation. After all, that phrase can be very intimidating. But at its heart, it’s very simple – guaranteeing our data has meaning. The good news is much of what we already do creates data integrity in our databases.
In this presentation, we will explore how the basic constructs in our database design enforce data integrity. We will look at this from table design down through details, like data types and constraints. Additionally, we will discuss the difference between objects that support data integrity and those that support database performance.
At the end of the presentation, you will have a better understanding of what data integrity is, how to implement and enforce it in your databases, and why it is so important for our data.
View the original webcast: https://www.idera.com/resourcecentral/webcasts/geeksync/data-integrity-demystified
MS DevDay - SQLServer 2014 for DevelopersДенис Резник
Presentation about hidden treasures inside SQL Server 2014. It was 30 min presentation about 4 features: Cardinality Estimator, Query and Plan Fingerprints, Delayed Durability and TempDB performance.
Visual Studio Live presentation on RavenDB. Introduces the concept of NoSQL databases and then takes you on a quick tour of the RavenDB .NET SDK - simple LINQ queries, loading related documents, dynamic and static indexes, and full-text search with Lucene and query suggestions.
SQL vs. NoSQL. It's always a hard choice.Denis Reznik
This will be an interesting and sometimes fun session with a small demo. This session will answer some of your questions and force you to think about new questions. It will not be very technical, so it's ok for choose another more technical session from the schedule :) But if will decide to come, I can assure you, that you will not be disappointed. We will do a thought experiment with one famous public high-loaded website, will look at advantages and disadvantages of SQL and NoSQL databases, and will choose the best database engine for it.
JSON is a de-facto standard for machine-to-machine communication but also to store "liquid" data. Once a killer feature of NoSQL database, with SQL Server 2016 is now available also in a (post) relational environment.
But how it fits in the relational database space? How the usage of JSON can simplify DBAs and DEVs everyday work? What about performances? And what about flexibility?
In this session we'll see how powerful JSON can be, when used correctly and not abused, providing solution to common problems
(like in the well known "dynamic schema" case), simplifying development (for example to pass to Stored Procedure complex objects or variable numbers of parameters) with also very good performances, even if they maybe hidden in not-so-obvious places.
High level look at RavenDB features presented as a 10 minute lightning talk at the Nov 19 2013 BTVWag.org meeting of 8 lightning talks on NoSQL databases.
Know thy cost (or where performance problems lurk)Oren Eini
Performance happens. Whether you're designed for it or not it doesn’t matter, she is always invited to the party (and you better find her in a good mood). Knowing the cost of every operation, and how it distributes on every subsystem will ensure that when you are building that proof-of-concept (that always ends up in production) or designing the latest’s enterprise-grade application; you will know where those pesky performance bugs like to inhabit. In this session, we will go deep into the inner working of every performance sensitive subsystem. From the relative safety of the client to the binary world of Voron.
Если раньше при старте нового проекта нам нужно было выбрать одну из доступных на тот момент SQL баз данных, то за последние 5 лет ситуация кардинально изменилась. Теперь выбор стал гораздо сложнее. SQL или NoSQL? Сloud или on-premises? Если SQL/NoSQL - то какая именно? А может использовать и то и другое?
В данном докладе мы постараемся представить общий обзор доступных сегодня решений для хранения данных и определиться с критериями выбора.
When we talk about “knowing our data,” we don’t seem to refer to the term “data integrity” anymore as part of that conversation. After all, that phrase can be very intimidating. But at its heart, it’s very simple – guaranteeing our data has meaning. The good news is much of what we already do creates data integrity in our databases.
In this presentation, we will explore how the basic constructs in our database design enforce data integrity. We will look at this from table design down through details, like data types and constraints. Additionally, we will discuss the difference between objects that support data integrity and those that support database performance.
At the end of the presentation, you will have a better understanding of what data integrity is, how to implement and enforce it in your databases, and why it is so important for our data.
View the original webcast: https://www.idera.com/resourcecentral/webcasts/geeksync/data-integrity-demystified
MS DevDay - SQLServer 2014 for DevelopersДенис Резник
Presentation about hidden treasures inside SQL Server 2014. It was 30 min presentation about 4 features: Cardinality Estimator, Query and Plan Fingerprints, Delayed Durability and TempDB performance.
Visual Studio Live presentation on RavenDB. Introduces the concept of NoSQL databases and then takes you on a quick tour of the RavenDB .NET SDK - simple LINQ queries, loading related documents, dynamic and static indexes, and full-text search with Lucene and query suggestions.
SQL vs. NoSQL. It's always a hard choice.Denis Reznik
This will be an interesting and sometimes fun session with a small demo. This session will answer some of your questions and force you to think about new questions. It will not be very technical, so it's ok for choose another more technical session from the schedule :) But if will decide to come, I can assure you, that you will not be disappointed. We will do a thought experiment with one famous public high-loaded website, will look at advantages and disadvantages of SQL and NoSQL databases, and will choose the best database engine for it.
JSON is a de-facto standard for machine-to-machine communication but also to store "liquid" data. Once a killer feature of NoSQL database, with SQL Server 2016 is now available also in a (post) relational environment.
But how it fits in the relational database space? How the usage of JSON can simplify DBAs and DEVs everyday work? What about performances? And what about flexibility?
In this session we'll see how powerful JSON can be, when used correctly and not abused, providing solution to common problems
(like in the well known "dynamic schema" case), simplifying development (for example to pass to Stored Procedure complex objects or variable numbers of parameters) with also very good performances, even if they maybe hidden in not-so-obvious places.
High level look at RavenDB features presented as a 10 minute lightning talk at the Nov 19 2013 BTVWag.org meeting of 8 lightning talks on NoSQL databases.
Ten query tuning techniques every SQL Server programmer should knowKevin Kline
From the noted database expert and author of 'SQL in a Nutshell' - SELECT statements have a reputation for being very easy to write, but hard to write very well. This session will take you through ten of the most problematic patterns and anti-patterns when writing queries and how to deal with them all. Loaded with live demonstrations and useful techniques, this session will teach you how to take your SQL Server queries mundane to masterful.
SQL Tips for the YouTube generation. 20 unrelated and independant tips, one right after another to speed up your database application without a ton of work.
SQL Tips for the YouTube Generation. They might seem random, but if you're a developer, these are the 21 things you need to know about Microsoft SQL Server, but probably don't.
Rails is a great Ruby-based framework for producing web sites quickly and effectively. Here are a bunch of tips and best practices aimed at the Ruby newbie.
Watch the full webinar at: http://embt.co/1pb4Zb4
This presentation is a must-see for anyone interested in Oracle 12! Dan is an Oracle ACE Director and has assembled this presentation with fresh and inside information from Oracle Corp and OOW13. Dan has pulled his top Oracle 12 features from the plethora of new features available and documented in his user group presentations "Oracle 12c New Features for Developers" and "Oracle 12c New Features for DBA's".
Top 10 features will include:
New SQL Syntax
New SQL and PL/SQL Limits
Pluggable Database
New Packages
Deprecated Features
New SQL Tuning Features
This presentation covers new SQL & PL/SQL syntax and options, the container DB of course, new SQL optimizer features, deprecated features, hints, and more. If you're supporting applications, then you won't want to miss this webinar!
These are the slides from a presentation given to the San Diego Salesforce Developer Group on September 16, 2014.
The presentation highlights why coding standards and design patterns are important parts of creating a scalable, maintainable Salesforce Enterprise Org. A series of specific implementation and architecture recommendations are outlined. Finally, models for process and governance are provided to help the viewer take steps to bring about change in their Org.
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDenny Lee
This is Nicholas Dritsas, Eric Jacobsen, and my 2007 SQL PASS Summit presentation on designing, building, and maintaining large Analysis Services cubes
Is SQLcl the Next Generation of SQL*Plus?Zohar Elkayam
Session from ILOUG I presented in May, 2016
Introducing the new tool from the developers of SQL Developer: SQLcl – a new command line tool from the SQL Developer team that might replace SQL*Plus and all of its functions which has been around for over 30 years!
In this session, we will explore the new functionality of the SQLcl, and use a live demonstration to show what SQLcl has to offer over the old SQL*Plus. We will use real life example to see what makes this tool such a time saver in day-to-day tasks for DBAs and developers who prefer using the command line interface.
Geek Sync I Need for Speed: In-Memory Databases in Oracle and SQL ServerIDERA Software
You can watch the replay for this Geek Sync webcast in the IDERA Resource Center: http://ow.ly/S6MG50A5ok5
Microsoft introduced IN-MEMORY OLTP, widely referred to as “Hekaton” in SQL Server 2014. Hekaton allows for the creation of fully transactionally consistent memory-resident tables designed for high concurrency and no blocking. With SQL 2016, many of the original restrictions and limitations of this feature have been reduced. IDERA’s Vicky Harp will give an overview of this feature, including how to compile T-SQL code into machine code for an even greater performance boost.
There’s also been a lot of buzz about Oracle 12c’s new IN-MEMORY COLUMN STORE. Oracle ACE Bert Scalzo will cover this new feature, how it works, it’s benefits, scripts to measure/monitor it and more. He will also touch on performance observations from benchmarking this new feature against more traditional SGA memory allocations plus Oracle 11g R2’s Database Smart Flash Cache. All findings, scripts and conclusions from this exercise will be shared. In addition, two very popular database benchmarking tools will be highlighted.
Database continuous integration, unit test and functional testHarry Zheng
Discuss continuous integration for database projects, including building project, deploying project to database, and executing unit tests and functional tests.
This presentation will also discuss database test standards, tips and tricks.
Migrate a successful transactional database to azureIke Ellis
This slide deck will show you techniques and technologies necessary to take a large, transaction SQL Server database and migrate it to Azure, Azure SQL Database, and Azure SQL Database Managed Instance
Power BI, SSAS Tabular, and Excel all use DAX. This presentation is meant to be used with a PBIX notebook found here: https://github.com/IkeEllis/democode/blob/master/IntroToDAX/Power%20BI%20Introduction%20to%20DAX.pbix
Given on a free DevelopMentor webinar. A high level overview of big data and the need for Hadoop. Also covers Pig, Hive, Yarn, and the future of Hadoop.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
1. Tips & Tricks with SQL Server
Performance Tuning, SSAS, SSRS,
SSIS, and More!
By Ike Ellis, MVP
@ike_ellis
www.ikeellis.com
Blog.ikeellis.com
http://www.linkedin.com/in/ikeellis
2. So you want to be great at SQL
Server… SQL Server Integration Services
SQL Server Analysis Services
Tabular
MultiDimensional
SQL Server Reporting Services
Excel
Data Quality Services
Service Broker
Performance Tuning
Indexing
Query Plans
Plan Analysis
Memory Management
SANs
Network
Clustering
Availability Groups
PowerShell
Master Data Services
Architecture
Data Mart Design
Data Normalization
CDC
NoSQL/BigData (At least the MS Cloud Offerings)
Competitive Knowledge (Oracle, Tablaeu, QlickView,
Postgres)
ORMs(Entity Framework, Nhibernate, Micros)
Installation/Configuration/Upgrading/Service Packing
Power BI
PowerMap
PowerQuery
PowerView
PowerPivot
T-SQL
Querying
Stored Procedures
Functions
Windowing Functions
Aggregates
CLR
MDX
DAX
XMLA
BCP
SQL Azure
Tooling
Redgate
SSMS
SSDT
Past Versions
Central Management
DacPacs/BacPacs
Profiler/Extended Events
Auditing
Security/Encryption
Replication
SQLCMD
3. Tips From the SQL Consultant
• For the YouTube/Reddit/Chive/Cracked/Meme generation
• Lots of disjointed tips
• Popular mistakes I see or easy things I think you can take
advantage of
• Between 3 – 5 minutes each
• Let’s see if we can get through all 20
4. TIP #1: Query Shortcuts
• SELECT COUNT(*) FROM
• SELECT TOP 100 * FROM
6. TIP #3: Low hanging fruit
• CRTL-R
– F6 switches between result tabs
• Copy, Paste a line without selecting
• COMMENTS CTRL-K, C, CTRL-K U
• BOOKMARKS CTRL-K, K, CTRL-K N
• Refresh cache – CTRL-SHIFT R
– Unless RedGate then CTRL-SHIFT D
7. TIP #4: Block Commenting
• Easy column selection – bring up the query window
– CTRL-SHIFT Q
• Format the columns comma first, like you’re supposed to
– SQL PROMPT – CTRL-K, CTRL-Y
• Alias a table
• CTRL-ALT arrow
• Add alias
8. TIP #5: Code Snippets
• CTRL-K, CTRL-B – Bring up Code Snippet Manager
• Copy an existing one from a path and put it in the My Snippets
Path
• Edit the XML
• CTRL-K, CTRL-X to place the snippet
• Great for common queries
– WhoIsActive
– sp_Blitz
– DBCC OPENTRAN
10. Tip #7: 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/
11. Tip #8: The right way to find hardware
problems
• Merging PerfMon and Tracing
• Get the Batch and Completed Events Only
• Never trace from the computer you are monitoring
• Always trace to a file and then load in a table after.
11
*Thanks, Grant!
12. Tip #9: 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 110
13. Tip #10: Check for heaps/clustered
indexes
SELECT t.[Name] FROM sys.Indexes i
JOIN sys.Tables t
ON t.Object_ID = i.Object_id
WHERE i.type_desc = 'HEAP'
ORDER BY t.[Name]
15. Tip #12: No reason to use ISNULL
CONCAT!
• Messy vs clean code
• No + symbol needed
• No ISNULL needed
16. Tip #13: How to search schema
• F7
• SQLSearch
– 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 name
from sys.all_sql_modules
where definition like '%cust%'
17. Tip #14: Windowing Functions are pretty
cool
• They are worth learning, and have a neat evolution
18. Tip #15: SSDT Search for options
• No more digging around in options
• Just search for everything
19. Tip #16: 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?
20. Tip #17: TempDB Configuration
• Current thought is 4 logical processors to 1 file
• Just a good beginning, your mileage may very
• Start there, then go to 2:1 or 1:1 if necessary
• Trace Flag 1117 or autogrow off
21. Tip #18: Prettify!
21
http://extras.sqlservercentral.com/prettifier/prettifier.aspx
RedGate PlugIn for SQL Server Management Studio
23. Tip #20: Life is so easy with a dates
table
• Find the sales numbers for the first Monday of every month
of the year
• T-SQL with no dates table
• T-SQL with dates table
25. Tip #22: Never reinvent the wheel
• Take SQL# for example
• Good Documentation
• Easy Syntax
• Cheap (and much of it is free)
26. Tip #23: Save scripts for easy
access
• Lots of repetitive scripts with business logic
• No reason to write the same queries for the same tables
day after day
27. Tip #24: Enforce Business Rules in the
DB
• Foreign Keys
• Unique Constraints
• Check Constraints
27
28. Tip #25: 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.TimeRendering
from 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.
29. Ike Ellis
• http://blog.ikeellis.com
• http://www.ikeellis.com
• YouTube
– http://www.youtube.com/user/IkeEllisData
• SQL Pass Book Readers
– http://bookreaders.sqlpass.org/
• San Diego Tech Immersion Group
• Twitter: @ike_ellis
• 619.922.9801
• Email address is just my first name @ikeellis.com
Editor's Notes
use tsql2012
SELECT *
FROMSales.customers
go
select *
from sales.orders
go
select top 100000 *
from sales.orders, sales.customers
update sales.customers
set contacttitle = null
where custid in ('59', '66', '78', '15')
use tsql2012
select * from sales.customers
select ContactName
+ ' - ' + ContactTitle
+ ', ' + City as GreetingLine
from sales.customers
select isnull(ContactName, '')
+ ' - ' + isnull(ContactTitle, '')
+ ', ' + isnull(City, '') as GreetingLine
from sales.customers
select concat(ContactName, ' ', ContactTitle, ' ', City) as GreetingLine
from sales.customers
use tsql2012
select *
from sales.orders
select custid, freight
from sales.orders
select custid, freight, sum(freight) as totalFreight
from sales.orders
select custid, sum(freight) as totalFreight
from sales.orders
group by custid
select custid, freight, sum(freight) as totalFreight
from sales.orders
group by custid
select custid, freight, sum(freight) as totalFreight
from sales.orders
group by custid, freight
--we're skipping subqueries, because they look ugly and
--it insults me aesthetically
;with FreightTotal
as
(
select custid, sum(freight) as totalFreight
from sales.orders
group by custid
)
select o.custid
, o.freight
, ft.totalFreight as totalFreight
from sales.orders o
join FreightTotal ft
on o.custid = ft.custid
--BIG IMPROVEMENT
--query can be executed independantly
--Can be reused, like this
;with FreightTotal
as
(
select custid, sum(freight) as totalFreight
from sales.orders
group by custid
)
select o.custid
, o.freight
, ft.totalFreight as totalFreight
, o.freight /ft.totalfreight * 100 as FreightPercentage
from sales.orders o
join FreightTotal ft
on o.custid = ft.custid
--but remember our original thought process
select custid, freight, sum(freight) as totalFreight
from sales.orders
--here's a windowing function
select custid
, freight
, sum(freight) over (partition by custid) as totalFreight
from sales.orders
--and reusing it is not that big of a deal
select custid
, freight
, sum(freight) over (partition by custid) as totalFreight
, freight / sum(freight) over (partition by custid) * 100 as FreightPercentage
from sales.orders
# We can narrow down the list by filtering on the source
Get-EventLog Application |
Where-Object {$_.Source -like '*sql*' `
-and $_.EntryType -eq "Error" `
-and $_.TimeGenerated -ge ((Get-Date).AddHours(-96)) `
} |
Format-List
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host
Write-Host "A"
Write-Host "B"
Write-Host "C"
SELECT * FROM (SELECT urgency, name, phone, location, department, cc, status, case_manager, ip, case_manager_ei d, id_problem, id_problem_type, eid_author, title, body, date_created, date_modified FROM problems AS main INNER JOIN (SELECT id_problem as t_urgency_id_problem, node_value AS urgency FROM problem_nodes WHERE node_name = "urgency")t_urgency ON t_urgency.t_urgency_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_name_id_problem, node_value AS name FROM problem_nodes WHERE node_name = "name")t_name ON t_name.t_name_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_phone_id_problem, node_value AS phone FROM problem_nodes WHERE node_name = "phone")t_phone ON t_phone.t_phone_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_location_id_problem, node_value AS location FROM problem_nodes WHERE node_name = "location")t_location ON t_location.t_location_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_department_id_problem, node_value AS department FROM problem_nodes WHERE node_name = "department")t_department ON t_department.t_department_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_cc_id_problem, node_value AS cc FROM problem_nodes WHERE node_name = "cc")t_cc ON t_cc.t_cc_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_status_id_problem, node_value AS status FROM problem_nodes WHERE node_name = "status")t_status ON t_status.t_status_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_case_manager_id_problem, node_value AS case_manager FROM problem_nodes WHERE node_name = "case_manager")t_case_manager ON t_case_manager.t_case_manager_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_ip_id_problem, node_value AS ip FROM problem_nodes WHERE node_name = "ip")t_ip ON t_ip.t_ip_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_case_manager_eid_id_problem, node_value AS case_manager_eid FROM problem_nodes WHERE node_name = "case_manager_eid") t_case_manager_eid ON t_case_manager_eid.t_case_manager_eid_id_problem = main.id_problem)t
;with FirstMondays
as
(
Select DateAdd(day, (9-DatePart(weekday,
DateAdd(Month, 1+DateDiff(Month, 0, '12/1/2009'), 0)))%7,
DateAdd(Month, 1+DateDiff(Month, 0, '12/1/2009'), 0)) as FirstMonday
union all
select DateAdd(day, (9-DatePart(weekday,
DateAdd(Month, 1+DateDiff(Month, 0, FirstMonday), 0)))%7,
DateAdd(Month, 1+DateDiff(Month, 0, FirstMonday), 0))
from FirstMondays
where firstMonday <= '12/1/2010'
)
select * from FirstMondays
use adventureworksdw2012
select EnglishMonthName, min(datekey)
from dimdate
where englishdaynameofweek = 'monday'
and calendaryear = '2010'
group by EnglishMonthName, MonthNumberOfYear
order by MonthNumberOfYear
create table t1
(col1 varchar(100))
insert into t1
(col1)
values
('1')
,('2')
,('3')
,('ike')
,('1')
,('2')
,('3')
,('ike')
, ('1')
,('2')
,('3')
,('ike')
select cast(col1 as int) from t1
select try_cast(col1 as int) from t1
Watch the actual execution plan for these statements:
drop table dbo.t1
drop table dbo.t2
--create two test tables
create table dbo.t1
(c1 int
, c2 int check(c2 between 10 and 20));
insert into dbo.t1
values
(11,12);
create table dbo.t2
(c1 int
, c2 int);
go
insert into dbo.t2
values
(101, 102);
go
select t1.c1
, t2.c2
, t2.c2
from dbo.t1
join dbo.t2
on t1.c1 = t2.c2
and t1.c2 = 20;
select t1.c1
, t1.c2
, t2.c2
from dbo.t1
join dbo.t2
on t1.c1 = t2.c2
and t1.c2 = 30;
DBCC OPENTRAN
select s.plan_handle
, t.text
, sum(s.execution_count) as totalExecutionCount
, sum(s.total_elapsed_time) as totalElapsedTime
, sum(s.total_worker_time) as totalWorkerTime
, sum(s.total_logical_reads) as totalLogicalReads
, sum(s.total_logical_writes) as totalLogicalWrites
from sys.dm_exec_query_stats s
cross apply sys.dm_exec_sql_text(s.plan_handle) t
group by s.plan_handle, t.text
order by sum(s.execution_count) desc