Most Web applications of any size involve the use of a database.
Typically, a Web application allows the addition or creation of new
records (for example, when a new user registers on the site), and
the reading and searching of many records in a database.
The most common bottleneck when developing a Web application is in the
reading of a large number of records from a database, or executing a
particularly complex SELECT statement against the database.
Writing to or updating a database usually is performed on a small
number of records at a time. This is often much less of an issue than
cases that involve reading thousands of records at a time. Consequently,
in this section, I look at different ways to speed up your database
queries (also known as reads). Many of the same techniques can be applied to
database updates (also known as writes).
Finally, since I'm looking at ways to write more efficient SQL
statements, the techniques presented here are independent of the
underlying database engine. Obviously, you will obtain different performance
improvements with different database engines, as well as different
database schema.