Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run multiple insert queries against firebird database using isql

I have requirement of inserting enormous data in table of firebird database around 40K entries. I got my scripts ready but while executing it using flameRobin, the UI just got hang forever while inserting such enormous data in one go.

I know it would be fine if i execute my insert queries in blocks of 255 queries but i want to know if there is any bulk insert tool available for Firebird to do such entries while reading from my scripts.sql file.

After some googling, I came across isql tool but not able to execute the scripts against it. Can someone guide me to any other tool or the proper documentation to enter such enormous data in one go?

I have firebird version 2.5 installed on my system.

like image 399
Rohit Vats Avatar asked Dec 12 '22 21:12

Rohit Vats


1 Answers

You can use EXECUTE BLOCK to stuff more inserts into a single statement. Something like this:

set term !! ;
EXECUTE BLOCK AS BEGIN
  insert into ... values ...;
  insert into ... values ...;
  insert into ... values ...;
  insert into ... values ...;
  ....etc.
  insert into ... values ...;
END!!

You can group them in 100 at a time or similar. This should make things go much faster and also improve FlameRobin's parsing.

isql is still faster, but this gives you better error control. It's really hard to debug stuff if some inserts in the middle fail with isql.

like image 137
Milan Babuškov Avatar answered Jan 14 '23 04:01

Milan Babuškov