Subject Re: [ib-support] insert in Firebird
Author Ann W. Harrison
At 02:43 PM 8/30/2001 -0300, C R Zamana wrote:

> Yes, is obvious to me that the application must be "converted" to a
>"relational" behaviour. I was only wondering if could be possible
>to do some "black magic" with Firebird in order to get a better solution.


There's still something wrong. I've just run a program that does a
TCP loop back to the Firebird on my 18 month old laptop. I stored
40,000 records, each about 600 bytes long in a minute and a half,
using EXECUTE IMMEDIATE and committing on every row. When I changed
the code so it made a new connection for each row, storing 4000 rows
took about 10 minutes.

Regards,


Ann



Information for the 40,000 row test:
Here are the times:

Start Thu Aug 30 18:28:24 2001
Stop Thu Aug 30 18:29:57 2001

Here is the data definition:

create database xyz.gdb;
create table dummy (
a varchar (60),
b varchar (60),
c varchar (60),
d varchar (60),
e varchar (60),
f varchar (60),
g varchar (60),
h varchar (60),
i varchar (60),
j varchar (60),
k varchar (60));

Here's the program:


database db = filename "caine:c:\\harrison\\play\\versions\\xyz.gdb";

#include <stdio.h>
#include <time.h>

main ()
{

int i;
char buffer [1024];
time_t ltime;

ready;
time (&ltime);
printf( "Start %s\n", ctime (&ltime));

for (i = 0; i < 40000; i++)
{
sprintf (buffer, "%s%s%s%s%s%s%s%s%s%s%s%7d%s\n",
"insert into dummy (a, b, c, d, e, f, g, h, i, j, k)\n\t values
(\n\t",
"\"123456789012345678901234567890123456789012345678901234567890\",\n\t",
"\"abcdefghijklmnopqrstuvwxyz........zyxwvutsrqponmlkjihgfedcba\",\n\t",
"\"123456789012345678901234567890123456789012345678901234567890\",\n\t",
"\"abcdefghijklmnopqrstuvwxyz........zyxwvutsrqponmlkjihgfedcba\",\n\t",
"\"123456789012345678901234567890123456789012345678901234567890\",\n\t",
"\"abcdefghijklmnopqrstuvwxyz........zyxwvutsrqponmlkjihgfedcba\",\n\t",
"\"123456789012345678901234567890123456789012345678901234567890\",\n\t",
"\"abcdefghijklmnopqrstuvwxyz........zyxwvutsrqponmlkjihgfedcba\",\n\t",
"\"123456789012345678901234567890123456789012345678901234567890\",\n\t",
"\"abcdefghijklmnopqrstuvwxyz........zyxwvutsrqponmlkjihgfedcba\",\n\t",
i, ");\n");

start_transaction;
EXEC SQL EXECUTE IMMEDIATE :buffer;

if ( SQLCODE != 0 )
{
printf ("gorp %d\n", SQLCODE);
break;
}
commit;
}

time (&ltime);
printf( "Stop %s\n", ctime (&ltime));
finish;

}