Mladen writes
Thanks for the reply.
I'll look at putting a trace on tomorrow. The background job is being
run by a PL/SQL stored procedure called by a DBMS_SCHEDULER job. The
job runs using the default job type.
I did some more digging around today, I added a few extra lines to a
copy of the procedure the scheduler calls, and those lines now write out
to a table with the systimestamp and where it has got to (it will write
out the status for each row). I appreciate that this should add an
overhead to the execution, but it doesn't seem to make that much
difference. What it did confirm was that the "execute" phase takes a
little over a second, and the rest of the time is spent processing the
results. Most rows are handled in under 1 millisecond, but roughly
every couple of thousand rows (I've done several runs, and it varies),
I'll get a row that takes 400 milliseconds. The performance seems to be
roughly linear across the result set (no getting slower as the CLOB gets
bigger). With this particular query (a little over 6100 rows), from
SQLPlus I'm getting 6-7 seconds, with the backgrounded version ~3.5
minutes.
This is leading me to think that the problem is in the handling of the
result set, rather than the execution of the select.