Beginning SQL
Beginning SQL Beginning SQL
Chapter 13 Gigahertz Networks or Compartmentalized Networks Another area where you can sometimes get large speed increases is by analyzing how your network is holding up to the load. Companies tend to grow haphazardly, adding employees all over the building and plopping down new workstations with little thought to what is happening to network traffic. In the Internet age, employees may be logging in to their workstations or the server using remote access, which can cause significant network overhead. Internet music and video downloads also cause massive congestion. It is not uncommon to end up with overloaded networks that can no longer keep up with the traffic being encountered. Oftentimes, new workstations can be purchased with gigahertz network cards. If the network is approaching saturation, moving up to gigahertz networks can open up the bandwidth enough to allow the applications to breathe again. Another thing that you can do is to compartmentalize the network such that different sections of the company come in to the server on separate routers, switches, or network interface cards (NICs). This is another area where there are tools to allow you to accurately measure whether the network is a bottleneck. Networks require expert assistance if you need to modify them, but if they are a bottleneck, then making those modifications can pay huge dividends. Caches A cache is a place where data is stored for fast access after it is retrieved from a location that takes significantly longer to access. This definition is flexible enough to work for all the various caches that you find on your computer, and there are many of them. The reason that you need to have at least a basic understanding of caches is that your queries are filling the caches with data, and your queries are also flushing the data out of the caches and replacing the old data with newer data. You might optimize a query and discover that it becomes lightning fast. The reason it becomes fast, however, may have less to do with your prowess as a SQL optimizer than because what you did allowed the data being worked on to remain in one of the caches. If this is the case, then if the amount of data suddenly exceeds the size of the cache, your query slows right back down again as the data needed gets flushed from the cache and replaced with other necessary data. Processor Cache The processor has a cache for instructions and data. This is typically a small cache, often as little as 8K for instructions and 32K for data, but in modern processors that amount may be in the hundreds of kilobytes or even megabytes. The processor caches are the fastest caches in the system. Getting data from the processor cache into the processor happens typically in a matter of one to a few clock cycles. At current processor speeds of 3GHz, a clock cycle is 0.33 billionths of a second, or one-third of one-billionth of a second. If your data fits in the processor cache, you are golden, and you get your results in the smallest possible time. Hard Disk Cache 352 The physical disk storage medium tends to require milliseconds (thousandths of a second) to access. Thus, getting data off the physical disk and into the disk cache (or into the system) takes as much as 10 milliseconds, or one-hundredth of a second — and that assumes that the disk is just sitting idle waiting for you to ask for data, a very rare occurrence. Thus, accessing data on the physical disk is more than 10 million times slower than accessing data in the processor cache. Remember that this is the time it takes to even start seeing the data.
- Page 696: Chapter 12 328 SQL security is cent
- Page 700: Chapter 12 Creating User IDs Figure
- Page 704: Chapter 12 3. In the SQL window, ty
- Page 708: Chapter 12 ❑ You can assign a dif
- Page 712: Chapter 12 Privileges Privileges ar
- Page 716: Chapter 12 338 You could then give
- Page 720: Chapter 12 You might implement this
- Page 724: Chapter 12 Another shortcut, using
- Page 728: Chapter 12 As you can imagine, givi
- Page 732: Chapter 12 The situation gets a lit
- Page 736: Chapter 12 Summary Database securit
- Page 740: Chapter 13 robust, fault-tolerant m
- Page 746: When an application asks for data f
- Page 750: The point of all the discussion of
- Page 754: How Do You Do It? And herein lies t
- Page 758: The slots are often implemented as
- Page 762: On the other hand, an index on a tr
- Page 766: Tuning Tips The following list cont
- Page 770: Database Tuning Exercises 1. Create
- Page 776: Appendix A Exercise 2 Solution 368
- Page 780: Appendix A ( 8, ‘Jack’, ‘John
- Page 784: Appendix A ZipCode, Email, DateOfJo
- Page 788: Appendix A Exercise 3 Solution Firs
- Page 792: Appendix A 376 Figure A-1 ISBN is a
Chapter 13<br />
Gigahertz Networks or Compartmentalized Networks<br />
Another area where you can sometimes get large speed increases is by analyzing how your network is<br />
holding up to the load. Companies tend to grow haphazardly, adding employees all over the building<br />
and plopping down new workstations with little thought to what is happening to network traffic. In the<br />
Internet age, employees may be logging in to their workstations or the server using remote access, which<br />
can cause significant network overhead. Internet music and video downloads also cause massive congestion.<br />
It is not uncommon to end up with overloaded networks that can no longer keep up with the<br />
traffic being encountered.<br />
Oftentimes, new workstations can be purchased with gigahertz network cards. If the network is<br />
approaching saturation, moving up to gigahertz networks can open up the bandwidth enough to allow<br />
the applications to breathe again. Another thing that you can do is to compartmentalize the network<br />
such that different sections of the company come in to the server on separate routers, switches, or network<br />
interface cards (NICs). This is another area where there are tools to allow you to accurately measure<br />
whether the network is a bottleneck. Networks require expert assistance if you need to modify<br />
them, but if they are a bottleneck, then making those modifications can pay huge dividends.<br />
Caches<br />
A cache is a place where data is stored for fast access after it is retrieved from a location that takes significantly<br />
longer to access. This definition is flexible enough to work for all the various caches that you find<br />
on your computer, and there are many of them. The reason that you need to have at least a basic understanding<br />
of caches is that your queries are filling the caches with data, and your queries are also flushing<br />
the data out of the caches and replacing the old data with newer data. You might optimize a query and<br />
discover that it becomes lightning fast. The reason it becomes fast, however, may have less to do with<br />
your prowess as a <strong>SQL</strong> optimizer than because what you did allowed the data being worked on to<br />
remain in one of the caches. If this is the case, then if the amount of data suddenly exceeds the size of the<br />
cache, your query slows right back down again as the data needed gets flushed from the cache and<br />
replaced with other necessary data.<br />
Processor Cache<br />
The processor has a cache for instructions and data. This is typically a small cache, often as little as 8K<br />
for instructions and 32K for data, but in modern processors that amount may be in the hundreds of kilobytes<br />
or even megabytes. The processor caches are the fastest caches in the system. Getting data from the<br />
processor cache into the processor happens typically in a matter of one to a few clock cycles. At current<br />
processor speeds of 3GHz, a clock cycle is 0.33 billionths of a second, or one-third of one-billionth of a<br />
second. If your data fits in the processor cache, you are golden, and you get your results in the smallest<br />
possible time.<br />
Hard Disk Cache<br />
352<br />
The physical disk storage medium tends to require milliseconds (thousandths of a second) to access.<br />
Thus, getting data off the physical disk and into the disk cache (or into the system) takes as much as 10<br />
milliseconds, or one-hundredth of a second — and that assumes that the disk is just sitting idle waiting<br />
for you to ask for data, a very rare occurrence. Thus, accessing data on the physical disk is more than 10<br />
million times slower than accessing data in the processor cache. Remember that this is the time it takes<br />
to even start seeing the data.