An adventure on SQL Server performance and features

T-SQL Tech

An adventure on SQL Server performance and features

T

Latest stories

A quick function to remove (or keep only) string patterns from SQL Server Strings

A

Working with strings in SQL Server isn’t as easy or powerful as using any programming language, but, I’m sure that more than once you had to to some data manipulation directly in the database, this may help you out, and it doesn’t use Loops, CLR or XML The idea is to exploit set logic, as opposed to the classic program logic of when you’re usually playing with strings in...

A PowerBI Report for SQL Server Agent Jobs

A

As my “community service” this month, I’ve worked on this neat (I hope!) PowerBI report (and companion stored procedure) to easily analyze all what you wanted to know about your Agent Jobs execution, but were too afraid to ask to the standard Reports in SSMS. This is part of the FirstRespondersKit toolkit, which I encourage you to check out. Installation: Install the...

How to populate a PowerBI Dataset from a REST API, using PowerBI’s REST API, without any code (via Microsoft Flow)

H

I was wondering if PowerBI could be used for reporting on Live data, not coming from my Database using DirectQuery (or the new super neat composite mode) with with a Streaming Dataset, which I never used before, so, I got to work. The Proof Of Concept is to take live data from Cryptocurrency value using REST API and pushing them into a PowerBI report.I’m using the API from...

SQL Server: How to Find a safe restore point (and who messed up) by reading from the Transaction Log

S

Panic: Someone has messed up and deleted a super important piece of information in a table! Who did it? Nobody knows. When did it happen? “The data was there this morning” Super useful info, thanks brah. So you activate your DBA Magic Powers© and try to deal with this stuff yourself: you need to identify which is the exact point where the data has been deleted (in order to minimize...

A script to automatically align columnstore indexes to enhance segment elimination (and hence performances)

A

Columstore indexes are a “new” neat data structure that I like, even if technically they’ve been around for years, only recently they’ve become usable by most customers. Let me recap a little bit what we’re talking about, so the point of this will be clearer: The table is divided in rowgroups of about one million rows max, then each column is stored by itself in a...

Troubleshooting SQL Server by analyzing the deviation from average values of Waitstats and Perfmon counters

T

Counters and Waitstats are good boys and useful for understanding what’s going on in your SQL instance, but often are pretty useless by themselves if you don’t know what’s a normal value for your server; For example a value of 100 batch requests/Sec is a value to worry about? It depends ¯\_(ツ)_/¯ What can be a sign of an issue? Something that goes way out of range compared to...

Tracking Dynamic SQL performance automatically with a wrapper on sp_executesql (Dynamic SQL Inception)

T

in some projects I have a lot of Dynamic SQL going on, some queries are fast, some queries are slow, it depends on how the dynamic statement is actually put together ¯\_(ツ)_/¯ Tracking the performance of such statements is usually difficult because you don’t really know “why it’s slow” and you have to interpolate data from the app and the plan cache (if the plan is still...

Creating a Perfmon and Filestats reports in PowerBI [Part 2]

C

In this previous post I detailed the structure of the objects to be created to create a live report in PowerBI to analyze Perfmon and Filestats data (which in my case was already being gathered but not used by the FirstRespondersKit tool); Let’s get to the PowerBI stuff. Here is the final result that we’ll reach: I’ll be starting from the existing FirstRespondersKit PowerBI...

A clarification on the waitstat: SOS_SCHEDULER_YIELD

A

Are you one of the people that says “we have a CPU related issue” whenever it sees SOS_SCHEDULER_YIELD popping up? Let me explain why you’re wrong. In the books online, SOS_SCHEDULER_YIELD is defined simply as: Occurs when a task voluntarily yields the scheduler for other tasks to execute. During this wait the task is waiting for its quantum to be renewed. Well, since the SQL...

An adventure on SQL Server performance and features

Emanuele Meazzo

My Social Profiles

If you're interested in following me around in the social world, here are some URLs for you