Search Results for: anything but query tuning

Why Put PostgreSQL in Azure

I've had people come up to me and say "PostgreSQL is open source and therefore license free. Why on earth would I put PostgreSQL in Azure?" Honestly, I think that's a very fair question. The shortest possible answer is, of course, you don't have to. You can host your own PostgreSQL instances on local hardware, or build out VMs in Azure and put PostgreSQL out there, some other VM host, or maybe in Kubernetes containers, I mean, yeah, you have tons of options. So why PostgreSQL in Azure, and specifically, I mean the Platform as a Service offering? Let's talk about it. PostgreSQL in Azure Let's assume for a moment that you're PostgreSQL expert (I'm not, but I do play one on TV). You know exactly how to set up…
Read More

Function Vs. Performance

Recently I was looking through DBA.StackExchange when I saw a pretty simple question that I decided to answer. I went off, set up a test database and some test tables and quickly wrote a query to answer the question. I got it all formatted pretty and was on my way to post it when I saw that another answer was already there. Yeah. Identical to mine. Almost line for line. Well, nuts. I know. I'll write a blog post. The Setup The original poster had two tables that, frankly, are badly designed. However, they share enough data that they are "related" if not relational. Here's the code: CREATE DATABASE Testing; GO USE Testing; GO CREATE TABLE Table_A ( ID INT IDENTITY(1, 1), Score INT ); CREATE TABLE Table_B ( FromPoint…
Read More

Tracking CPU Use Over Time

A question that I've seen come up frequently just recently is, how to track CPU use over time. Further, like a disk filling up, people want to know how to predict their CPU usage, so that they can easily decide "now is when I upgrade the hardware". Well, the bad news is, that ain't easy. CPU Use Over Time There are a bunch of ways to look at processor usage. The simplest, and probably most common, is to use the Performance Monitor counters such as '% Processor Time'. Query this, you can get an average of the processor usage at a moment in time. Ta-da! Fixed it. I thought you said this was hard Grant. Well, hang on. Are you running on a single processor machine? If so, cool, maybe…
Read More

You Are A Coder

So, you say you're a DBA. I say you're not. You say you're a system administrator. I say you're wrong. We are all coders now. Every single one of us. You are a coder. Put down the brick and let me explain. Automation There was a time when I would give a presentation to a room full of people and ask, "Who is using PowerShell right now?" and get, 15 hands out of a hundred. Last week at SQL in the City in London, the same question came up and most of the room raised their hands. What's changed? Automation. Automate all the things!!! The simple fact of the matter is, anything easy, repetitive, and quantifiable is, has been, or shortly will be, automated. You should not be spending your…
Read More

Extended Events and Stored Procedure Parameter Values

One complaint I've received frequently is that you can't see stored procedure parameter values in Extended Events. That is patently not true. However, it does depend on where and how you capture the events and which stored procedure parameter values you're going for. I think this is a holdover from 2008 when Extended Events... well, let's be kind and say... didn't work well. Now, they do. Let's explore this a little. Capturing Stored Procedure Executions As with most things, there's more than one way to capture stored procedure execution in Extended Events. First up, it depends entirely on how they're called and on your intentions when you capture the information. Here are the three methods I know to capture just the completion metrics on stored procedure calls: rpc_completed sql_batch_completed module_end…
Read More

Execution Plan Shortcoming in Extended Events

I use Extended Events almost exclusively for capturing query metrics. They are the most consistent and lowest cost mechanism for getting the time and resources used by a query. They can be filtered, combined with other events, they're just marvelous... until you capture an execution plan. Execution Plans in Extended Events Don't get me wrong. Capturing execution plans with Extended Events is the way to go if you're attempting to automate the process of capturing plans on specific queries on an active system. It's step two that bugs me. So, we capture the plan. Here's an example script. Captures all the various plans and the batch, puts 'em together using causality tracking: CREATE EVENT SESSION ExecutionPlansOnAdventureWorks2014 ON SERVER ADD EVENT sqlserver.query_post_compilation_showplan (WHERE ( sqlserver.database_name = N'AdventureWorks2014')), ADD EVENT sqlserver.query_post_execution_showplan (WHERE…
Read More

PASS Board Update: Post-Summit 2016

Monday I got in on Sunday and chose to have a small dinner with a couple of friends, quiet, preparing. Monday was a less hectic day than the others . The Board had the morning off, although Redgate had me go and give a session at an event. Monday afternoon was one of our three in-person board meetings. The minutes will be published soon. I was responsible for running the meeting. I also presented two topics, first, and most importantly, our current financial status. Then I presented the initial set of thoughts towards some SMART goals for Global Growth, which I will share once they are further developed . Monday evening I had two events I had to attend. First, as part of the Executive Committee, I attended the kick off dinner…
Read More

Correlated Datetime Columns

SQL Server is a deep and complex product. There's always more to learn. For example, I had never heard of Correlated Datetime Columns. They were evidently introduced as a database option in SQL Server 2005 to help support data warehousing style queries (frequently using dates and times as join criteria or filter criteria). You can read up on the concept here from this older article from 2008 on MSDN. However, doing a search online I didn't find much else explaining how this  stuff worked (one article here, that didn't break this down in a way I could easily understand). Time for me to get my learn on. The concept is simple, turning this on for your database means that dates which have a relationship, the example from MSDN uses OrderDate and…
Read More

It’s Not Too Late

You know you want to go on the SQL Cruise. You can. You just have to convince the boss that it's worth doing. It is. I've said it before and I'll repeat it as necessary, SQL Cruise changes peoples lives. I've watched people go on the cruise with a job and come back with a career. People don't just learn on the Cruise. They get energized. They get engaged with the data professional community. How do I profit by promoting SQL Cruise? I don't. Tim Ford is a friend and I'm supporting him. My company, Redgate Software, is a sponsor of the cruise, so I'm supporting them. I could just be doing the bare minimum in support of these parties. However, I'm not getting paid anything special by anyone for doing more.…
Read More

Hey Kids! Let’s Put on a Show at the Old Barn

Alternate Title: I'm traveling a bunch. Let's get together and talk. A bunch of trips and presentations coming up, so I thought I'd share. First, I'll be SQL Saturday Omaha for my first time ever presenting in Nebraska. I'm excited to add this state to my list (which is almost over 40 now). If you're not doing anything August 15th, let's have a chat. Next, fingers crossed, I'll get selected to fly back to my home state, Oklahoma, to go to SQL Saturday OKC. These guys put on a great event and hey, it's Oklahoma so how can it be bad. I hope they announce soon. I need to schedule my flights. This one is on August 29th. September also has several events. First, I'll be at SQL Saturday Las…
Read More