Multi Statement Request vs separted insert in Teradata

Viewed 265

is Multi Statement Request more peroformant than multiple separated request in teradata ?

I have a mainframe job that lunch a bteq script that is actually Multi Statement Request as described in the example below :

   insert into table (col1, col2, col3) values (val1,val2,val3)
 ; insert into table (col1, col2, col3) values (val4,val5,val6)
 ; insert into table (col1, col2, col3) values (val7,val8,val9);
 

my question is should I keep this one job for the Multi Statement Request or separe it into multipe jobs for each insert ? which way is more performant ?

Thanks in advance.

1 Answers

If you are using BTEQ you can do a batch/bulk insert operation using the .REPEAT/PACK command. An example:

.set sessions 5
.logon ...
.import vartext ',' file = \\your\file\path\somefile.csv;
.repeat * pack 100
using (val1 integer, val2 varchar(20),val3 varchar(10))
insert into table (col1, col2, col3)
values(val1, val2, val3);

Even better is using a proper utility like fastload or TPT, but short of that any way you can cram your inserts into a single request the better off you are.

Related