20.07.2013 Views

Beginning SQL

Beginning SQL

Beginning SQL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Perhaps this doesn’t sound remotely like application tuning, but the application runs on machines. If the<br />

machines don’t support the application, you are never going to tune it enough to make a difference!<br />

Database Files<br />

Client server DBMSs (as opposed to file server DBMSs such as Microsoft Access) often allow you to distribute<br />

the database across many different hard disks. The objective is to split the database into files,<br />

with each disk holding a single file containing one or a set of tables, or even sets of indexes. By splitting<br />

the database up like this, you can get the physical input/output (I/O) distributed across many electronic<br />

channels, you get the disks accessing their pieces of the data in parallel so that the data from one disk<br />

can be read while the other disks are looking for data being requested, and finally you get cache on each<br />

hard drive holding a piece of the database.<br />

DBMSs like <strong>SQL</strong> Server and Oracle have tools that allow you to set up complex, time-consuming queries<br />

and then watch the physical IO (disk access) to see if you are saturating the data channel(s), in other<br />

words transferring the maximum amount of data that the disk is capable of putting out. If this happens,<br />

then you have discovered a bottleneck and should consider splitting the database down into more files,<br />

one file per hard disk, which means adding hard disks to the system. Correctly implemented, adding<br />

hard disks to the system raises the amount of data that can be read out of the database. When the point<br />

is reached where the hard disks can feed data faster than the processor can handle it, you have eliminated<br />

one bottleneck and can look elsewhere for the next bottleneck.<br />

Processors<br />

Database Tuning<br />

DBMSs are one of the applications that are specifically written to utilize multiprocessor systems.<br />

Multiprocessing simply means having more than a single central processing unit (CPU) in the server box.<br />

While they are not cheap, adding processors to a database server can in certain circumstances make the<br />

database significantly faster. The reason is that queries can be broken down into pieces, and those pieces<br />

assigned to different processors. The individual processors handle pulling the indexes for their individual<br />

piece of the puzzle, narrowing down the data and finally returning a small data set to a processor<br />

that puts all the pieces back together into the original query. Just like breaking the database itself down<br />

into files on different hard disks, the net effect is to get parallel processing happening so that the whole<br />

process is executed faster.<br />

Unfortunately you usually can’t simply pop in an additional processor to upgrade your server. The<br />

motherboard has to be designed to hold multiple CPUs before you can do this. Even if you can add a<br />

new processor (there is an empty CPU socket), if the machine is old, adding the new processor may be<br />

difficult or impossible. Getting your hands on the processor for a five-year-old machine may be difficult,<br />

and even if you manage to do so, the slow speed of the processor may make the performance boost less<br />

than you might hope for compared to buying a new multi-gigahertz machine. On the other hand, if you<br />

can find a processor to pop into your multiprocessor machine, doing so almost certainly would provide<br />

some performance increase and would almost assuredly be better than no upgrade at all.<br />

If your current database server system has a clock speed of less than 1GHz, and certainly if it is a singleprocessor<br />

system with a clock speed of less than 1GHz, moving up to a modern machine (possibly with<br />

multiprocessors) would almost assuredly provide large efficiency gains over what you have now. It isn’t<br />

cheap, but if the budget allows it, this may go a long way toward speeding up almost any slow database<br />

application.<br />

351

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!