Problem solve Get help with specific problems with your technologies, process and projects.

Ran query once, but TKPROF report says query ran 22 times

I manually turned on SQL Trace from SQL*Plus to test a new query. I ran the query once, turned off SQL Trace, then ran tkprof on the trace file. The TKPROF report tells me that the query ran 22 times, however I only ran it once. I even bounced the database before my SQL Trace session. Why does if tell me the query ran 22 times if I only ran it once? Here are the statistics from the TKPROF report:
call     count       cpu    elapsed       disk      query    current       rows
------- ------  -------- ---------- ---------- ---------- ---------- ----------
Parse        1      0.10       1.95          0          0          0          0
Execute      1      0.01       0.00          0          0          0          0
Fetch       22      0.71      15.65       2756       6789          0        310
------- ------  -------- ---------- ---------- ---------- ---------- ----------
total       24      0.82      17.60       2756       6789          0        310

Processing a query requires at least three distinct steps: parse, execute, and fetch. Your query was parsed and executed once, and there were then 22 fetch calls that resulted (because of array fetching) in 310 rows returned. You can experiment with the SQL*Plus command SET ARRAYSIZE to see how it affects the number of fetches.

Dig Deeper on Oracle database performance problems and tuning

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.