Tuesday, October 23, 2012

PASS DBA Virtual Chapter Trimming Indexes, Getting Your Database in Shape

Hello Dear Reader!  Tomorrow at 12 noon eastern I’ll be presenting for the PASS DBA Virtual chapter, click here to sign up for the meeting.

If you aren’t a member of/or familiar with PASS it is the ProfessionalAssociation for SQL Server.  PASS put’s together great things for us throughout the year like SQL Saturdays, which are put together by local PASS User Groups (click here to find the one in your area) groups that meet FREE monthly and have presentations on different SQL topics, The PASS Summit (Largest SQL Server conference in the world!), 24 Hours of PASS (free 12 spans of great training), and the PASS Virtual Chapters.  Virtual Chapters range 16 different subjects and 3 different languages, soon to be four different languages!

Joining PASS doesn’t cost you a dime, and I don’t get a penny for it, but it opens the door to a large amount of free technical content and training.  If you are not familiar I’d encourage you to click on the above links and become familiar with PASS today!

“So Balls”, you say, “What is this presentation you’re doing?”

Glad you asked Dear Reader!  I’m presenting for the DBA Virtual Chapter, 1 of the 16, and my subject is Trimming Indexes, Getting Your Database in Shape.

I’LL TAKE THE #2 SUPER SIZED

Here’s the abstract and then we’ll talk a little more:

Indexes are a wonderful thing. We should be using them, and we should be maintaining them. But over time our production databases start to look a little pudgy around the mid-section. Maybe they are a little bloated with Unused Indexes, maybe they have Duplicate Indexes, and possibly even Reverse Indexes. The first step to fixing these problems it so see if you have them and if you do the second is to set about fixing them. You could be costing yourself CPU cycles, I/Op's, and space and never even know it.

If you’ve been a DBA for a while you will inevitably inherit a system where you find indexes being used in less than optimal ways.  A lot of this is created by turn over in a company, going with all of the suggestions from DTA (Database Tuning Advisor), or having too many cooks in the kitchen.

It is possible to get things like Reverse Indexes, Duplicate Indexes, and unused Indexes.  You may be asking,  “What do those terms mean?  What secret ninja SQL Language are you speaking?  I know Clustered and Non-Clustered, but what-in-the-sam-hell is a REVERSE index!?”

It’s alright Dear Reader, no new secret terms.  A Duplicate index is just an Index where the physical structure exists more than once on a table.  Take the following Table:

CREATE TABLE Students(
          studentID int identity(1,1) primary key clustered
          ,ssn char(9)
          ,firstName varchar(50)
          ,middleInitial char(1)
          ,lastName varchar(100)
          ,gender char(1)
          )

If we created a Non-Clustered Index on the SSN column and we called it nclx_Students_SSN, and then someone else made a Non-Clustered Index on the SSN column and called it nclx_Students_SSN2 we would have a duplicated index.

“But Balls”, you say, “I would never do that!”

Of course not, you wouldn’t ever do that on purpose.   As code gets migrated from Dev to Production perhaps the Developer or Jr DBA adds an index that they didn’t realize you already has in place.  Or maybe you get a query plan with a “Missing Index hint” in Dev, only that index had been created as an urgent Production change, and never got implemented in Dev.  Migration comes around and as long as the names are different, WHAMO, you have two Non-Clustered Indexes on your SSN Column.

This example might not seem that bad, but imagine a 50 row table with a duplicate Non-Clustered Index on 5 rows, 10 rows, or 15 rows.  That’s a lot of extra data having to be persisted to disk and maintained.

"I wish my abs..I mean... databases where in shape"
Using the previous table let’s know make a Reverse Index.  We’ll create a Covering Non-Clustered index for a stored procedure that requires the SSN, FirstName, and LastName fields.  Some farther down the road you’ve left that company and a new developer is writing a different block of code and a different stored procedure and they create their Non-Clustered Index on LastName, FirstName, and SSN.

Then you have Unused Indexes.  These are the indexes that it seemed like a good idea to build, but nobody is using them.  In some places you have code that gets retired, but we still need the database structures,  in the Data Modeling phase Indexes were designed that were not used, or Database Tuning Advisor recommended it and it just wasn’t used.

Finding these are important because we are maintaining them, but the slackers do not contribute to our query performance. 

WRAP IT UP

So our goal for the hour will be to discuss Indexes make sure that we have a good foundation in them and what they store so we can understand why these 3 types of indexes are bad, and then use some scripts and DMV’s to identify them.

I'm also doing this presentation in a much longer format for SQL Live 360 in December of this year, as well as a couple more presentations.  Click on this link to check out Live 360!

I hope you’ll get a chance to stop by and join us!

Thanks Again,

Brad

Thursday, October 18, 2012

DBA Study Guide


http://www.flickr.com/photos/caledonia09/4999119065/

 Hello Dear Reader, over here at Pragmatic Works we’ve been growing like weeds.  For the most part we are looking for Sr level people for Sr. Level positions.  Part of that process is interviewing.  Going for a job as a Sr. Consultant is a bit different than going for a job as a DBA. 

Today’s market for DBA’s is quite good.  If you are looking there are jobs out there.  A lot of the time after weeks or months of interviews when the “ideal” candidate has not been found you tend to lower the requirements.   It’s the Animal House “We need the dues” moment. 

Only for a business it is we need a butt in the seat.  You start asking the questions can we find someone with the right attitude, someone who can learn, someone who might not be at the level we want, but we can work with.  Often you can find a diamond in the rough and grow that person into the experience level you wanted.

In the Consultant biz it’s a bit different.  You can do that for Jr or Mid level jobs, but Sr level positions require you to really know your stuff.  You cannot expect a person to know everything, and one person’s Sr is another person’s Jr.  Not to mention there is a wide area of DBA expertise to be considered.  But we have to draw a line in the sand, and Knowledge is very important.


Can you answer some of the following questions:

  1. What is a heap?
  2. What is a Clustered Index, a Non-Clustered Index, and what are the differences between the two?
  3. What is a Page Split?  
  4. What is a Forwarding Pointer?
  5. Why do they matter?


If you cannot then I wanted to toss out some learning resources that cover a wide breath of area.  This is similar to the Microsoft Certification exams where they say know how to Baseline a server, couple different ways to skin that cat, so I know there are a LOT of different things to each very general area.
(*Note no actual cats were skinned in the process of writing this blog).  

This is just a collection of books that I’ve read over the years.  Some go in depth in particular areas, some are general and cover many.   My buddy Mike Davis (@MikeDavisSQL | Blog) wrote a similar list for BI folks if you are interested in that click here to read more.

But I wanted to toss them out so if you are looking for a good book you can find one.  Just looking to grow in a particular area?  Then these will help you as well.


Internals:  If you are looking for a book on Internals you cannot go wrong with Kalen Delaney(@SQLQueen | Blog).  The 2012 Internals book is due out in November, and I can’t wait to read it.  This book has many wonderful contributors and is well worth the money even though a new one is on the way out.  I cannot recommend this book enough.












Internals/Extended Events/Troubleshooting:  Christian Bolton (@ChristianBolton | Blog) put together an All-Star team for this book (a 2012 edition is due out soon as well).  It not only covers internals but tools to diagnose them from some of the Premier experts in the field.  I put this neck and neck with any book.  If you work with SQL Server 2008/R2 you should own a copy.













Query Tuning:  Grant Fritchey (@GFritchey | Blog) is a damn nice guy.  I don’t understand why people think he’s a Scary DBA, (Grant thanks for the advice on the Katana collection and sharpening swords in front of the daughter’s boyfriend before dates, priceless).   I just don’t understand the scary thing at all.  Regardless of his disposition Grant is the guy that wrote the book on Query Tuning and Execution Plans.  He is a master in this field and the only people I would regard higher are the people Grant would recommend.














Clustering:  Alan Hirt(@SQLHA | Blog) is to clustering what Grant Fritchey is to Query Tuning.  I’ve attended Alan’s pre-con’s, read his books, and watched his generous and free advice via #SQLHelp.  If you are working in clustering you should have Alan’s book it will point out best practices and save you head ache’s (I’m looking at you government SOC’s Image when setting up a 2008 Cluster).













Replication: I wanted to recommend a replication book however, I haven’t purchased this one.  My friend and co-worker Chad Churwell (@ChadChurchwell | Blog) is one of the smartest replication guys I've ever met and he recommends it. I’m making the recommendation because of Chad and I have done more replication as a Consultant that I did as a DBA.  I’ve set it up, I’ve fixed it, I’ve learned how to find out when it’s broken, what broke it, and why.  I’d also bet I’m not alone.  I’ve only read the free pre-view of the book and chapter wise it summarizes everything I’m looking for an Expert in Replication (other than experience).














Mirroring:  I would put Robert Davis(@SQLSoilder | Blog) in the realm of Mirroring what Grant and Alan are to their respective books.  Robert has blogged incredibly useful and real world information about mirroring.  AND YES I understand that Always On Availability Groups are the way to go.  However, not everybody is on SQL 2012, and a solid understanding of Mirroring allows you to better understand all the goodness that is Always On Availability Groups.














Hardware and Virtualization:  When it comes to hardware you don’t get much better than Glenn Berry(@GlennAlanBerry | Blog).  From his free Assessment Scripts on SQL Server Performance (Glenn's is here) is essential when you go onto a new server for the first time and try to holistically figure out what is going on right and wrong.  The first chapter alone taught me more about CPU’s and which to choose than years of experience had.  I was able to use this knowledge immediately.













Performance Indexing: Jason Strate (@StrateSQL | Blog) and Ted Krueger (@Onpnt | Blog) are incredibly smart guys.  SQL MVP’s, years of experience, and deep knowledge all combine to give you an answer to the age old question ‘What should I index and Why?’.  Indexing is a core thing that DBA’s should know about.  Adding, removing, finding good ones, and identifying bad ones are important.  Not to mention the answer to all of my previous questions are in this book.










SQL Server 2012/ SQL Azure/Powershell:  I work with some pretty smart guys.  SQL MVP’s, Consultants, and their friends are just as smart.  These two books are a collabertaive effort between brilliant people  Adam Jorgensen (@AJBigData | Blog), Brian Knight (@BrianKnight | Blog), Jorge Segarra (@SQLChicken | Blog), Patrick Leblanc (@PatrickDBA | Blog), Aaron Nelson (@SQLVariant | Blog), Julie Smith (@JulieChix | Blog)…And MORE (sorry for the people I left out)!  If you are looking for information on SQL 2012 and how to use it go to the Bible and their other book on Professional Administration.















 WRAP IT UP!

A lot of books I know and no I don’t expect you to read all of them before an interview, but there are a lot of common theme’s in the world of SQL Server.  A good expert should be EXCITED about what they learn about.  They should be able to pick something tell me what they know, and I’d like them to do it in a way that I’m excited about it by the time they finish.

I love going to SQL Saturday’s, PASS Events, and Conferences because they make me excited to learn.  And I really love to learn.  Find something that you are passionate about, and learn it really good.  That kind of learning and passion is infectious and is exactly what makes all of the authors I’ve mentioned such great SQL Server professionals. 

Hopefully, whether you’re looking for a job or not, it will help you find something that you love to learn about.

Thanks,

Brad


Thursday, September 27, 2012

SQL Saturday 151 Interview: Stacia Misner





Hello Dear Reader SQL Saturday 151 is just around the corner.  If you haven't registerd there is still time to sign up now, click here!

Tomorrow kicks off with our Full Day Pre-Con's at the with Kevin Kline(@kekline | Blog) of Quest Software and Stacia Misner (@StaciaMisner | Blog) of Data Inspirations.  Click Here to read more about our DBA Pre-Con  and Click Here to read more about our BI Pre-Con.  There are still a few seats remaining so if you haven't signed up do so today!

Stacia was kind enough to sit down and have an interview with me running a wide gambit of topics.

We talked about Teaching being involved in the SQL Community and of course the up coming Pre-Con.

I hope you enjoy!


1.       What got you into IT and then into SQL Server as a Career?  Was the move to work with SQL Server straight to BI or where you ever a DBA?

My first official job in IT was as a installer/trainer for a software company that developed applications for tractor dealerships (which eventually customized for car dealerships as well). My mom had been one of the original employees there as a developer and thought it would be a good opportunity for me.

 She wasn't working there when I started working there, but in later years she did rejoin the company although we worked in completely different departments. My job was to travel out to tractor dealerships and get their IBM System 36 installed and configured and then to teach the personnel how to run their business using the computer.
Most of them had been on manual systems. I did some custom reporting development for them because, of course, canned reports in the software never answered the questions that management really had.

When we started moving our applications to PC-based systems, we had a database backend and that's where I started to learn how to write SQL queries but I didn't know anything about database management. Fast forward many years and I was in another software company as a project manager for custom development in the legal industry. I stumbled on Business Intelligence while I was looking for information on the Internet to use to train up a new employee on project management skills.

I read about cubes and thought this had to be valuable to the types of reporting and analysis that we were trying to incorporate into our software, and that's when my career veered off into BI. At the time, I managed a team of Lotus Notes and Java developers, and we extracted data from our Lotus Notes databases into Oracle databases so that we could do more sophisticated reporting than we could in Lotus Notes. I went straight from that in to BI - I've always been involved in one way or another in getting data out of computers into a format that people need for analysis. 



2.       You just moved to Alaska, why Alaska and what do you love about it?

I moved to Alaska because my husband told me when were dating (many, many years ago) that he would be happier living with me in a shack in Alaska than he would in a mansion in (somewhere I forget now).

So I wanted him to prove it to me! But more seriously, he's a country boy and was never very happy in our city homes. To rectify that, we were looking for property out in the country somewhere in the Western states a couple of years ago and a long-lost childhood friend of my husband's called during that time and described where he was living in Alaska. It had everything we were looking for, except it wasn't as close to an airport as I required. So I said I would put up with the travel inconvenience as long as I could get a decent Internet connection, which we made happen, and so here we are!

 Travel inconvenience is putting it mildly. It's quite an ordeal to get in and out of here - but it's an amazing place to be while I'm home. We're still getting set up and stocked up, but I love the access to fresh foods from the sea and from nature - we have all the salmon and halibut and other types of fish that we could ever want, plus wild mushrooms (chanterelles and morels) and a variety of edible seaweeds. We'll be building a greenhouse for year-round veggies. I go for a walk almost every morning when I'm home - rain or shine - and walk about 3 miles with a neighbor and see more deer (and sometimes bear and bald eagles) each day than I see people in a week. It's a beautiful view and environment, and I'm really glad to be here!



3.       You’ve had the opportunity to travel to many different places and teach to many different people and audiences.  What has your favorite experience been as a teacher?  What was your favorite location to travel to?
I have lots of favorite experiences as a teacher.  I really like to experience a place through its foods and I had a list of foods to try during the week I was there. It was my personal food scavenger hunt!

Each day at lunch I would ask my students to help me identify what was on our lunch menu to determine what I could cross off my list. On Thursday, I was asked if I would join some of the students for dinner to get some of the other items on my list. I assumed we would be going out to a restaurant, but I was invited to a flat that one company had rented for the students they had sent to my class and they cooked dinner for me.

Meanwhile there was an incredible storm outside - hurricane force winds in Warsaw! But we had such a wonderful time enjoying homemade food and they were telling me Polish folk tales as we waited out the storm. And to cap it off, one of the students told me she had used one of my books in a college course (which she had neglected to tell me all week until that night!). That evening was truly a memorable experience!

 As for my favorite location, that's more difficult question to answer because there have been so many places and so many wonderful people that I can't single out just one!


4.       How has the SQL Server Community, and/or being involved with it, affected your life?

Being involved in the SQL Server Community has given me the opportunity to meet people from all around the world. On a personal level, my husband is on a mission to acquire a certain breed of dog which is not commonly found in the US, so he found breeders in other countries and suggested I go to these places and I thought - I KNOW people in those countries who I could ask for help with the language, etc. How nice is that?

On a professional level, it's extremely helpful because I have a network of like-minded people that I can connect with regularly which is so important as an independent consultant who doesn't have an office full of co-workers. I've been able to participate in many projects as a result of having met people through community and I've been able to connect people that I know with clients that need their sort of expertise.

Having this network as a result of the SQL Server Community also helps me keep aware of important happenings and trends in the industry, provides a sounding board when I'm dealing with challenges, and keeps me motivated to keep learning more and to see the same old things in new ways. 

5.       Last year you attended SQL Saturday 62 in Tampa and later you were at SQL Rally in Orlando, this year it is back to Orlando for SQL Saturday 151.  What keeps you coming back to visit the SQL Server Community in Florida?
I have a lot of friends I like to see in the SQL Server Community in Florida and it's a nice place to visit most times of the year!

6.       Your Pre-Con looks fantastic, if I was speaking to someone at an HR/Training department who should I tell them they should send to attend?

The Pre-Con is going to cover a lot of ground, although it is specific to the BI features in SQL Server 2012. The people who will benefit the most will be those who have some familiarity with earlier versions of SQL Server BI because I will talk about the things you need to know to make the transition more easily and I'll point out what's most important in the new features. If you're completely new to BI, you won't have the right context.

Anyone responsible for BI architecture, solution development, or BI support would benefit from this Pre-Con if a SQL Server 2012 upgrade is on the horizon, or if you're wondering why (or if) you should bother with an upgrade. 

7.       Why is BI so important to the business world?  Do you have any stories about how BI investments help change or shape a company that you worked with (that you can tell without breaking any confidentiality agreements)?

BI is so important because there are so many questions and there is so much data, but it's not so easy for a business person to find the answer to their questions. The structure of the data that is necessary for capturing transactions just doesn't lend itself well to summarization and comparative style queries. I don't think any of my clients would say that BI revolutionized their business.

 Instead, they would say that having BI has freed up their time so that they can spend more time thinking about what to do in response to what they learn from BI rather than spending all their time trying to gather the data and piece it together to make sense of it somehow. 


8.       I’m a DBA, why would I want to learn about BI?
I know enough about DBAs to know that there are different types of DBAs, so I would say it depends... I think you need to understand enough about BI to determine which tool is right for which job and then shift the work where it will get the best performance with the hardware and BI developer resources available.

You might even be an accidental BI developer, if not now, maybe soon. There is no escape from BI! The bottom line is that the business wants data for analysis, yesterday. The easier you make that process and the faster you can deliver, the more of a hero you can be.

9.       Your presenting Data Visualization in Reporting Services during the SQL Saturday 151 event, how does this tie into the pre-con?

They're actually unrelated. My Pre-Con focuses on SQL Server 2012 whereas my Data Visualization presentation talks about what you can and should do in Reporting Services to tell the right story, and that's applicable regardless of what version of Reporting Services you're using.

That said, I will also delve a bit into spatial data visualization which is SQL Server 2008 R2 feature along with some other items that were introduced in that version, but the main theme of the session is about design techniques - good and bad.

10.   If you could give one bit of advice to someone starting out in the IT field what would it be?

Find your passion and run with it, as long as you can see how it solves a business problem. Everybody likes different aspects of technology, which is good thing else we'd all be in each other's way.

When you find what you're passionate about, you don't mind spending extra hours learning about it, whether you're getting up early or staying up late. You want to eat, breathe, and live it while everyone around you thinks you're nuts! But that passion pays off when you can use it to help others solve their problems.

The more problems you can help people solve, the more valuable you are, and the more you want to learn so that you can expand the range of problems you can solve. It's a vicious cycle!


As Always Dear Reader Thanks for stopping by and I hope to see you Tomorrow and this Saturday!

Thanks,

Brad