Category Archives: SQLServerPedia Syndication

SQLSaturday 57 In Houston, Here I Come!

Another year and staring it off right! I’ll be speaking at SQLSaturday in Houston, TX on the fundamentals of storage and SQL Server. I love this talk. I give it regularly and it’s like an old friend to me. Near and dear to my heart, IO subsystems and SQL Server have been my bread and butter for quite a while. So, if you are going to Houston come find me and say hi. There is only one thing more than educating people, and that is getting to know those people.

Understanding SQL Server and Storage Systems

The most important part of your SQL Server is also the slowest, Storage. This talk will take you through the fundamentals of your server’s Disk I/O System. From how hard drives work, through RAID configurations, and how to configure the file system. This session should give you a solid foundation over storage systems and help you understand why they are slow and how to overcome some of their limitations.

Session Goals

  • Understand the physical characteristics of IO hardware.
  • Understand the fundamentals of RAID.
  • Understand how to configure the file system.

See you there!

#SQLRally is coming, Go vote!

 

We are in the final stages of selecting the speakers for the SQLRally May 11th through the 13th in sunny Orlando FloridaSQLRally Winner[11]. The program selection is a little different than what we have done with the Summit. The committee narrowed the number of selections and is putting the rest up to a public vote. This is your opportunity to voice your opinion on what you would like to hear at this inaugural event! I’ve been fortunate enough to have two of my sessions put up for a vote. If you follow my blog you know I have a passion for moving bits of data around as fast as possible. Both my sessions focus on storage. As much as I would love to have your votes to see my sessions at SQLRally, I would like it even more if you voted on what YOU want to learn about the most. Having served on the program committee for Summit last year I know just how hard it can be choosing what I think people would like to learn about. having the opportunity to make your choice known directly is just awesome. I am very excited to see PASS expand and have training events that cover the gambit. Starting with local user groups and SQL Saturdays now growing with SQLRally and finishing it off with the Summit, there is something for every budget.

With that said, here are my abstracts so you can get a better idea of what I’m speaking on. GO VOTE!

Title:
Solid State Storage Deep Dive
Speaker:
Wesley Brown
Category:
Storage
Level:
100

Abstract:
If you have ever wanted to know how SSD’s and Flash memory works this talk is for you. We will cover the fundamentals of Flash in detail. I will also highlight some of the specific vendor implementations and what makes a particular SSD enterprise-ready vs. consumer grade. We will also cover SQL Server usage patterns what is a good fit for SSD’s and when it may be better to go with hard disks. Solid State Storage isn’t a cure-all for every situation, this presentation will give you the tools you need to make the right choice for your SQL Server environment.

Session Goals

  • Understand the fundamental building block of Flash memory.
  • Get a clear explanation of what makes some SSD’s robust enough for enterprise use.
  • Learn where SSD will and won’t make a real difference in your SQL Server environment.

Title:
Understanding Storage Systems and SQL Server
Speaker:
Wesley Brown
Category:
Storage
Level:
100

Abstract:
The most important part of your SQL Server is also the slowest, Storage. This talk will take you through the fundamentals of your server’s Disk I/O System. From how hard drives work, through RAID configurations, and how to configure the file system. This session should give you a solid foundation over storage systems and help you understand why they are slow and how to overcome some of their limitations.

Session Goals

  • Understand the physical characteristics of IO hardware.
  • Understand the fundamentals of RAID.
  • Understand how to configure the file system.

A New Year, Time To Get My Learn On!

altMy friend, and newly minted MVP, Jen McCown (blog|twitter) is hosting  T-SQL Tuesday this month. I normally don’t do the T-SQL Tuesday, but this is a post about resolutions so I am resolving to do more of them in the new year. I’ve always considered myself a core engine kind of guy. Focused on things like I/O, on disk structures and the optimizer. As SQL Server grows it has become harder and harder to keep up with the Joneses’ (Steve?). Like every other DBA that earned their salt in the mines of 6.0 through 2000 I’ve got a ton of tools I’ve written myself to monitor every aspect of SQL Server. I’ve also not kept up as well with other technologies like replication that have an impact on my day to day life at work. So, with all that in mind this is my list of technical things to “get good at” this year.

SQL Server Stuff

1. Partitioning
I’ve worked on and off with partitioning since SQL Server 2000 and have a solid grasp of how it works and what the benefits are, just not at a deep enough level. I found myself telling someone that was just flat wrong a few weeks ago about partitioning in SQL Server 2008 R2. It wasn’t a huge deal but if I’m spreading misinformation I’m doing my community and myself harm.

2. Change Data Capture
Again, I’m using a throw back from the good old days. Using triggers to capture change data and insert that into history tables. It’s time to get rid of this performance robber and move to something a tad more modern. I sat in a couple of sessions at PASS and think if I can rap my head around it we could see a large improvement in performance.

3. Replication
I feel pretty good about my replication skills but it is becoming very important to our infrastructure and I need to make sure that I’m not making assumptions that aren’t true anymore and that I’ve configured my environment as best as I can. I sat in on Kendal Van Dyke’s (blog|twitter) replication at PASS and came away with a couple of things that I need to do and some additional things to research.

4. Analysis Services Administration
We are moving full boar into the BI stack. It isn’t my job to write MDX but I have to make sure that the performance from an infrastructure level is good and that we are prepared to recover if the need arises.

.Net Programming Stuff

1.LINQ
I do some stuff with LINQ including LINQ to SQL but I need to get better at it. Just trying to keep my mediocre c# skills from falling off completely.

2.Parallel Programming in .Net
I write a ton of multi-threaded stuff and have built up my own threading frameworks over the years. Microsoft is making a big push to make parallel programming easier. With PLINQ and the new Async framework that is in development right now. It isn’t a part of my core job skills but it is something I enjoy and use quite a bit.

3.Entity Framework
I don’t have to like it but it is everywhere I turn these days. I do get questions as well on how to optimize the database and without knowing exactly what is going on under the covers it limits my ability to troubleshoot issues.

90 Degrees From Center

1. Get Better With Python
I do more than Microsoft stuff and still enjoy learning new things. I recently picked up on Python and look to keep growing my skillset with 2.7 and 3.x lines. It is a fun language to program in. If you dig on easy to read and easy to write Python has that in spades.

2. Pick Up Lisp again
You heard me. Lisp the grandfather of modern functional languages. I worked with Lisp about a million years ago it seems. Apparently, it is back in vogue with several dialects floating around and quite a robust community supporting them. I can get a bit religious at times but passionate people make for a culture of innovation.

The Dangers of Sub-queries!!!!

Ok, now that I have your attention this really should be titled the danger of not qualifying all objects, but that isn’t quite as sensational enough to make you click through to here 🙂

Imagine if you will, a developer expects ten records to be inserted into a table and the query has been running for almost an hour.  A quick glance and sp_who2 shows that it is using a lot of IO, I mean a lot. The first thing that happens is a command decision from the boss to kill the query. I took a quick peek and found the plan still in the plan cache while we waited for this thing to roll back. As I look at the plan I see something really wrong. It looks like the table receiving the inserts isn’t getting the ten records we thought but 169 million records, every record from the table in the select clause.

I look at the query and on the surface everything looks good. When I hit the check mark it compiles without error. Looking at the plan in detail I notice a little icon that tipped me off on where to look next.

image

Oh that’s bad. Warnings: No join predicate. Ouch. But this is a sub-query, how can I have no join predicate? Lets take a look at an example.

DROP TABLE #t1
DROP TABLE #t2
GO
CREATE TABLE #t1 (
  t1id    INT   NOT NULL,
  t1name  VARCHAR(50)   NULL,
  t1place VARCHAR(50)   NULL)
  
ALTER TABLE #t1
 ADD   PRIMARY KEY ( t1id )
 
CREATE TABLE #t2 (
  t2id    INT   NOT NULL,
  t1name  VARCHAR(50)   NULL,
  t1place VARCHAR(50)   NULL)
  
ALTER TABLE #t2
 ADD   PRIMARY KEY ( t2id )
 
INSERT INTO #t1
SELECT 
  spid,
  loginame,
  hostname
FROM   
  MASTER.dbo.sysprocesses
WHERE  hostname <> ''

INSERT INTO #t2
SELECT 
  spid,
  loginame,
  hostname
FROM   
  MASTER.dbo.sysprocesses
WHERE  hostname <> ''

This gives us two tables with some data. We want to find all the records in #t1 that also exist in #t2 but instead of a join we will use an IN and a sub-query.

SELECT 
  t1name,
  t1place
FROM   
  #t1
WHERE  t1id IN (SELECT 
                 t1id
                FROM   
                 #t2)
 

Looks simple enough and will pass the compile test all day long even though t1id doesn’t exist in #t2. Since you can use columns from the top level query in the sub-query this is a perfectly valid piece of T-SQL.

It gives us this plan when we look at it though.

image

And there you have it, a join without an ON clause as far as the optimizer is concerned. By not qualifying all the columns in the sub-query we opened ourselves up to this error. This isn’t the optimizers fault! If we re-write this as it was mean to be:

SELECT 
  t1name,
  t1place
FROM   
  #t1
WHERE  t1id IN (SELECT 
                 t2id
                FROM   
                 #t2)
 

We get a plan that is more to our liking.

image

You could also re-write this as a join instead of using the IN clause and would have avoided this problem as well. Scary way to learn that SQL Server will do exactly what you tell it to even if you are wrong!