Hi all,
I have a performance issue with simple INSERTs. Say I try to perform 300 inserts in a for loop. It appears as though interbase is running/executing in 60 second intervals - it takes exactly 60 seconds before any anything happens, and at that time I get the results of the 1st 130 insert statements, all at once. Then precisely 60 seconds later I get the results of the next 150 insert statements. Then after about 10 seconds I get the results of the remaining few queries. All of this is wrapped in a transaction.
I am trying to insert the records from our web server (linux+apache 1.3.x, PHP 4.2.3) to an interbase db running on the client pc (win2k running IB6 as a service). No problems connecting to the database, selecting records is fine too, the problem I am having seems to be with INSERTs (haven't tried updates yet!). After each insert I print the results to the browser so I know whats happening, yet I only get output at 60 second intervals.
Here's what I am doing:
$cn = ibase_connect('11.22.33.44:C:/path/to/data/MYDB.GDB', 'USERNAME', 'pAsSwOrD');
if ($cn) {
$trans=ibase_trans($cn);
$q = ibase_prepare($cn, 'INSERT INTO mytable (f1, f2, f3, f4) VALUES (?, ?, ?, ?)');
for ($i=0; $i < 300; $i++) {
echo $i.'<br>';
ibase_execute($q, $i, $i, $i, $i);
}
ibase_commit($trans);
ibase_free_query($q);
ibase_close($cn);
echo "completed OK!<br>";
} else echo "unable to connect!<br>";
I have tried all sorts of variations on this. It doesn't matter whether I commit after each executed query or not, or use the inherent transactions of interbase (ie, don't start my own transaction and just use a commit at the end), or use ibase_query alone instead of the ibase_prepare/execute approach. Running this locally takes less than 1 second (local apache web service and local interbase db), compared to more than 3 minutes remotely (remote webserver to view web page, connecting to local interbase db). Even the output being printed to the browse withing the for loop only appears in 60 second intervals - and if I exclude the ibase_execute() everything runs in under 5 seconds.
Does anyone know what may be causing this? Is it a configuration setting? Is it a database locking issue? Any suggestions are greatly appreciated.
Thanks in advance,
-MK