Databases Reference
In-Depth Information
municate with the database server. See the section, “Database Driver
Architecture,” page 55, for more information about database driver architecture.
When an application makes a standards-based API request, such as execut-
ing a Select statement to retrieve data, the database driver transforms that API
request into zero, one, or multiple requests to the database server. The database
driver 3 packages the requests into database protocol packets and sends them to
the database server, as shown in Figure 4-6. The database server also uses data-
base protocol packets to transfer the requested data to the driver.
Packets Sent from the Driver
Driver
Packets Sent from the Database Server
Figure 4-6
Database protocol packets
One important principle to understand: The relationship between applica-
tion API requests and the number of database protocol packets sent to the data-
base is not one to one. For example, if an ODBC application fetches result set rows
one at a time using the SQLFetch function, not every execution of SQLFetch
results in database protocol packets being sent to or from the database. Most dri-
vers optimize retrieving results from the database by prefetching multiple rows at
a time. If the requested result set row already exists in a driver result set cache
because the driver retrieved it as an optimization on a previous SQLFetch execu-
tion, a network round trip to the database server would be unnecessary.
This topic repeatedly demonstrates that database application performance
improves when communication between the database driver and the database is
optimized. With this in mind, one question you should always ask is this: How
can I reduce the amount of information that is communicated between the data-
base driver and the database? One important factor for this optimization is the
size of database protocol packets.
The size of database protocol packets sent by the database driver to the data-
base server must be equal to or less than the maximum database protocol packet
size allowed by the database server. For example, if the database server accepts a
3 Generally, we state that the database driver sends the database protocol packets to the database server.
However, for drivers that have a client-based architecture, this task is performed by the database client
(Net8 for Oracle, for example).
Search WWH ::




Custom Search