SQL Query Exit Calls in Call Graphs
Often times application code executes database calls in multiple phases. For example:
- Construct and execute a SQL query
- Iterate over the result set
For example:
stmt = con.createStatement();
# Execute the query
ResultSet rs = stmt.executeQuery(query);
# Iterate through the results
while (rs.next()) {
String PizzaType = rs.getString("PIZZA_TYPE");
float price = rs.getFLoat("PRICE");
}
The Java Agent represents JDBC SQL query executions and the iterations over the result set display separately in the call graph:
- For the execute call, the call graph shows the SQL query and the execution time. You can access the exit call details through a database link in the External Call column.
- For the iteration over the result set, it shows a count for the number of iterations and the total time. You can access the exit call details through a result set iteration link in the External Call column.
The .NET Agent does not separate ADO.NET SQL query execution exit calls from iteration over the result set in the call graph.
The Python Agent and the Node.js Agent sometimes separate out iterations as separate exit calls based upon the database driver used to make the call.
Minimum Capture Threshold Times for SQL Calls
The query and result set iteration are both subject to the minimum capture threshold times for SQL calls (which is 10 ms by default). If the execution time for a query or result set iteration does not exceed the threshold, then it does not appear in the call graph. This means that a given database interaction may be represented in a call graph in one of three ways depending on which parts of the operation took longer than 10 ms, if any:
- Only the query appears (Callout 1)
- Only the ResultSet iteration appears (Callout 2)
- Both appear (Callout 3)
Click the link to view more details for the SQL exit call, or the result set iteration.
Maximum Number of SQL Queries in Snapshots
By default, the maximum number of SQL queries in snapshots is set to 500. For Java
Agents, you can increase the value of the
max-jdbc-calls-per-snapshot
node property if you do not see
expected SQL queries in a call graph.