13 Nov SQL University Hoops Practice
OK everyone, nice job against DB2 U the other night. Now, we don’t have any games this week but next week we have to travel up to play UDB. We know they are disciplined on defense, so we are going to work on some set plays. We have been getting lazy with some of our offensive cuts and we’ll fix that in the next few sessions. Today we are going to go through some quick drills to get our legs working and then run through some inbounds plays and then we’ll scrimmage in the time left. OK, layups <whistle blows>.
Let’s go hard on these today and keep your focus. We missed some easy baskets last time because we didn’t finish strong. Get some in from the left side as well, keep working on the off hand; you’ll need it someday.
Learn the difference between clustered and non-clustered indexes. Find out when it is necessary to have one or the other (or often both). Become familiar with how they are structured as objects inside of the database.
Remember, game shots at game speeds. If I catch you walking to your spot I’ll put you on the line to run some sprints. This is not time to rest, this is time to work on your skills. You rest here, you rest in a game, and the team suffers. It’s that simple. Work hard and be rewarded.
Now that you know about clustered and non-clustered, and when each might be more useful, dive into index maintenance. How frequently do you need to update your stats? When do you rebuild? Or should you reorganize? And where is the work performed? In tempdb? Will there be table locks associated with your maintenance tasks? Spend some time learning these details and do your best to match them to the requirements for your shop.
Let’s put things together now. You know what an index is, you know the different types, you understand the need to have regular maintenance. That’s fine, but do you know how to use them to tune queries? If a customer has a query that is taking “too long”, do you know how to examine a query plan to see if the indexes are being properly utilized? Get familiar with the estimated and actual execution plans in SSMS. Start looking at the system DMV’s to find out if your indexes are being used. Get familiar with queries and indexes as a part of performance tuning.
All too often people look to make things faster by buying bigger and faster hardware. Save your company some money by learning how indexes work before you spend any money on hardware.
The first objective for any out-of-bounds (OOB) play is to get the ball in play safely. Keep that in mind whenever a play breaks down. The second objective is too get yourself into the right spots in order to secure a scoring opportunity. You are assigned a particular spot because you fill the need for that role for that particular play. And you need to learn more than one spot for each play because there are going to be times when we need you to fill in for someone else that could be hurt or in foul trouble.
Same principles apply to performance tuning and indexes. Know your role. Are you expected to help design the systems before they get deployed? Or are you expected to simply support the systems after deployment? And is every issue treated as if you are down three with five seconds to play? Or do people approach you with issues as if it is halftime and there is enough time on the clock to make adjustments?
Let’s stretch our legs a bit today, we need to get better at moving up and down the court. We inbound the ball and look for a sideline break each time. If it isn’t there we don’t force it, we get into our spots and work the half court offense. Our goal is to get a shot off every time we touch the ball. I track the number of possessions we have each game; every time we have the ball we should score one point. The more times we touch the ball, the more points we should score.
Add up the number of shots we take, plus the number of turnovers, and subtract out the number of offensive rebounds. You get a rough estimate of your possessions and divide by the number of points. If you are running an efficient offense then you should not be less than 1, otherwise you are not getting the right shots.
Being on a team means you have to know your role. Each person has a specific skill that they are better at than others. The job of the coach is to take those skills and assemble them into the best team possible. There is an old saying that “players are made in the summer, and teams are made in the winter.” It’s true, you work on your skills more in the off-season and during the season we spend time putting the pieces together in order to be successful as a team.
Same in your shop. You have a team of people you work with. You all need to fill your role. And the same goes for the SQL community. You should never feel as if you cannot contribute in some way, no matter how small. You may not be the best scorer, but you can rebound. And some cannot score or rebound but the play great defense. You may not be able to tune indexes in your sleep like other appear to be able, but you do have other valuable experiences that you can share with the rest of the community.
Let’s figure out where you can fit into the community and get you started on contributing in some way.
OK, here is the starting five against UDB:
OK, let’s finish up with some sprints, everyone on the line <whistle>.