I have the following situation
main()
{
hnd = CreateTHread( func1 );
// Call fun2()
wait(hnd);
return ;
}
fun2()
{
//Access database to perform some read operation on TAble A
}
func1()
{
//Access database to perform some read operation on TAble A
// Recursive operations
}
What I observed is, fun2() takes a longer duration to complete if I use threading approach. Could it be since the THread func and fuc2 are working on the same table. Note, there is only a read operation in both the functions. The AWR report suggested , number of query exectutions increased when the threading approach was used
A similar question – Multi-threaded database read access
Oracle JDBC interfaces as well as Oracle native drivers (i suppose) are capable of handling multithreaded requests ( http://www.cs.umbc.edu/portal/help/oracle8/java.815/a64685/tips1.htm )
However when it comes to implementation in the database engine – this is not clear. From the current documentation my understanding is that as long as your request is READONLY with no intent to update no locking would occur and you should be seeing a performance boost (atleast minor).
There are many other factors however that determine whether the engine would use parallelism. The hardware config of the server (multi-core) etc can also determine if the query engine resorts to a parallel or queued approach.
Btw how much of timing difference are your observing in both approaches that you have tried. What was the magnitude of your data ?