Sunday, January 22, 2006

SQL Performance reports from profiler traces

Over the December and January period I have been working with some developers to get their database performance improved. Not that there has been a problem with performance, rather we have been looking proactively at the slower stored procedures and reviewing the SQL and the logic behind each to see if we can improve.

This has lead to the need for the ability to compare the performance of stored procedures over periods. After finally fixing the buggy SQL code which returns the stored procedure name or DML that was run, I reworked some older code to return a comparison of some performance metrics over two periods.
This code uses two inline views which then join on the stored procedure name or DML SQL to compare number of calls, total duration and the main one, duration per call. This enables us to produce a report which can quickly identify code which is running significantly slower.

Unfortunately I am not going to publish that code just yet. I want to rework into a stored procedure which can be added to an expanding library of jobs and stored procedures to performance tune SQLserver.
The plan is to have a complete solution to provide the tools to automate performance metric collection and reporting using tools provided by SQLserver. I am hoping that people will be able to download a zip file which provides an easy install.
Tuning based on the reports is always going to be harder, but capturing the information is the first step.

After some other workload is over (doing an database migration), I will have time to recode into stored procedure and also install and play with SQLserver 2005.
Given the new performance tables, and my existing library of Oracle scripts I should be in a position to remap those Oracle scripts to use the new SQLserver 2005 tables where possible.

Have Fun

Battlefield 2 fun

I haven't played FPS (First Person Shooters) in a while. Having a family with 2 little kids doesn't lend itself to having much time to be mucking around playing computer games.
However after I cleaned up the study (spare bedroom) in the house, Santa was good enough to give me Battlefield 2 for xmas.

I had been playing the demo on and off for 2 months and decided to buy the game. Demos are a great way to try before you buy. The full version of the game is always better than a crippled version. In BF2 demo, it was one map, but it was enough to showcase the game.

So I am happily smashing the computer AI bots in singleplayer even on veteran level, so it was time to face reality and play against humans. You can not code the computer to act like humans.
For example, in another multiplayer game Starcraft (real time strategy RTS), we were playing each other in a local LAN game of 6 players. One of players nuked their own base to destroy an attack. The computer would never do that.

So I go to the GameArena Bigpond Games servers and after some false starts due to network problems I am in a 32 player map. I got my ar*e kicked. I think I managed about 10 kills over about 5 games, and was killed 10+ times each of those.
The hardest part was I knew noone in the game, plus I hadn't been using the chat and talk functions at all, so I couldn't communicate quick enough. eg. Stop driving as there are mines ahead.
On the fun side of things I learned a couple of things
1) Head ons at sped are a good way to kill more people even if you die.
2) Some players are awesome flying jets, deadly accurate too.

The funniest situations were
1) Missing throwing a grenade into a helicopter three times... I need practice. I managed to bounce the grenade off the helicopter instead of landing inside which would have killed 4.
2) Being rocket-ed to death and returning the favour later.

More practice is required which should be fun

Have Fun