In the 2003 remake of "The Italian Job", Seth Green plays the character Lyle, alias "The Real Napster". He cracks the computerized Los Angeles traffic system and brings traffic to gridlock. By turning on and off the traffic lights, he creates hopeless snarl across LA - accept for a special route that allows the good bad guys to deliver justice to the real bad guy.
My Aunt is convinced local traffic is caused by someone like "The Real Napster" changing traffic signals. The people that run the spy satellites are also a possible culprit. She likes to remind me that the spy satellites are always watching, often while looking up as if she could catch one in the act. If not these sorts, where does the traffic come from? Everyone is driving home or to work, so why do they have to slow down? Cars seem happy to drive fast at lunch time. Why is it that every once in a while, everyone is parked on the freeway some Sunday evening at 11pm?
The modern view of a database allows Ruby on Rails or the latest Java Framework to connect database tables to an AJAX web client and everyone is thrilled at how little time it took. Framework developers all claim they have finally found Fred Brooks� silver bullet. They begin to extrapolate on the trend of modern technology and wonder how many decades before vacations to the moon will be affordable to what used to be called the middle class. The Post Modern skeptic acknowledges the power of modern hardware and its ability to hide yesterday�s performance problems - up to a breaking point. The Post Modern skeptic believes design problems will always be difficult, which is what Fred Brooks actually said. The Post Modern skeptic accepts the truth.
The basic problem with traffic is that people want to be where someone else already is. Traffic slows as people wait for their turn to move their car into one of the coveted spots, usually the middle of some intersection. Traffic lights mark intersections where people are moving across a stretch of road in conflicting directions. One or more directions have to completely stop while cars move across the road in the other direction. I am convinced everything you need to know about database performance and tuning you can learn from road traffic, maybe even while waiting in traffic.
Database performance is just like street traffic. Someday I need to talk to the programmers that make the Sims games about this. The database with its tables is like a city with its roads. The processes that run on the server in response to someone�s query or update statement is like a little person in a car, traveling along the different tables. A database allows many different processes at the same time. Each process is a little car on its way to work. Traffic intersections are where different tables are responding to more than one process at a time. Congestion happens when too many cars intend to travel through the same intersection at the same time. The Sims programmers could do something with this idea.
There are three main issues affecting database performance, and each has a corollary in the traffic world. The first issue is establishing structure behind where businesses, shopping malls, and Starbucks are located relative to where people live. The second issue is the where one allows roads and more importantly where roads are restricted. The third issue is the placement of traffic lights, because not every intersection may require a light. With the database, these issues are called normalization, stored procedures, and locking.
Unfortunately, I can only hope "The Real Napster" and the satellite people can get together and fix our traffic. But I can help programmers understand how to improve database structure and create less congestion for the little Sims cars. The next three articles cover the main techniques one can use to improve database performance.