I have a simple Perl 5.6 test script that uses DBI and DBD::Oracle to connect to a
local Oracle 9i database table and retrieve the data in the three small fields of its
only two records.
Why is the connection time so long and how can I shorten it? It is 3 to 4 times longer
than retrieving data from a MySQL database.
Using the "Time::HiRes" module, I am able to show how long it takes to connect to the
database, and how long it takes to return the two records.
This is the connection string:
$dbh = DBI->connect("dbi:Oracle:$dbname", $user, $passwd) or die("OOPS: $DBI::errstr");
It takes 2.9342188835144 seconds to connect to the database.
It takes 0.0100140571594238 seconds to retrieve the data and print it.
It takes almost 1 second longer using this connection string:
$dbh = DBI->connect("dbi:Oracle:host=$location;sid=$dbname", $user, $passwd);
I also used "d:DProf" and ran the test script, and then "dprofpp -u" to analyze the
resulting "tmon.out" file:
Total Elapsed Time = -0.00189 Seconds
User Time = 0.416244 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c Name
21.6 0.090 0.090 1 0.0900 0.0900 DBD::Oracle::db::_login
21.6 0.090 0.159 1 0.0899 0.1592 DBD::Oracle::dr::load_dbnames
21.6 0.090 0.159 6 0.0149 0.0265 main::BEGIN
12.0 0.050 0.050 11 0.0045 0.0045 Exporter::import
4.80 0.020 0.050 10 0.0020 0.0050 DBI::BEGIN
2.40 0.010 0.010 116 0.0001 0.0001 DBI::_install_method
2.40 0.010 0.010 3 0.0033 0.0033 Carp::longmess_heavy
2.40 0.010 0.010 2 0.0050 0.0050 Exporter::export_ok_tags
2.40 0.010 0.010 10 0.0010 0.0010 strict::import
2.40 0.010 0.010 1 0.0100 0.0100 vars::BEGIN
2.40 0.010 0.020 2 0.0050 0.0100 DynaLoader::BEGIN
2.40 0.010 0.010 18 0.0006 0.0005 Win32::TieRegistry::BEGIN
0.00 0.000 -0.000 1 0.0000 - warnings::BEGIN
0.00 0.000 -0.000 2 0.0000 - warnings::register::import
0.00 0.000 -0.000 4 0.0000 - warnings::register::mkMask
Sincerely,
Paul Appleby