Databases Reference
In-Depth Information
Using a prepared Command object typically results in at least two network
round trips to the database server:
One network round trip to parse and optimize the statement
One or more network round trips to execute the statement and retrieve
results
Performance Tip
If the application makes a request only once during its life span, using a
nonprepared Command object instead of a prepared Command object is a
better choice because it results in only a single network round trip.
Remember, reducing network communication typically provides the most
performance gain.
See “SQL Statements,” page 27, for more information about using state-
ments versus prepared statements. See “Using Statement Pooling with
Connection Pooling,” page 238, for information about performance and using
statement pooling with connection pooling.
Using Arrays of Parameters/Batches Versus Prepared Statements
Updating large amounts of data typically is done by preparing an Insert state-
ment and executing that statement multiple times, resulting in numerous net-
work round trips.
Performance Tip
To reduce the number of network round trips when updating large
amounts of data, you can use arrays of parameters or batches of SQL
statements.
Let's compare the following examples.
 
Search WWH ::




Custom Search