All Forums Tools
muthu1802 20 posts Joined 01/12
26 Mar 2014
BTEQ Parallel Execution to speed up executing SQL statements

Currently I am executing SQL statements one by one as below,

bteq << EOB
.logon XXXX
.OS rm -f  file.sql
.export data file=file.sql

SQL statement1;
SQL statement2;
SQL statement3;
SQL statement4;
SQL statement5;
SQL statement6;
SQL statement7;
SQL statement8;
SQL statement9;
SQL statement10;

.export reset

and it is taking more time.
Is there any way we can speed up the execution by making the execution process parallel in BTEQ.

sgarlapa 88 posts Joined 03/13
26 Mar 2014

You can try as below set more sessions and as a multi statment request -
.set sessions 8;

SQL statement1

;SQL statement2

;SQL statement3

;SQL statement4


;SQL statement10


krishaneesh 140 posts Joined 04/13
26 Mar 2014

@SriLaxmi, I do not think this will make the sql's run in parallel. instead it will increse the number of sessions connecting to Teradata and will execute each query faster.
@Muthu: Are the sql's interdependant like the output of the preceding query becomes the input for the current query etc.. If not then create multiple BTEQ scripts with single sqls and you can call all of them in a Shell script in parallel.

sgarlapa 88 posts Joined 03/13
27 Mar 2014

Hi Krishna,  increasing the sessions would make the time lesser which is the objective. 
And can you clarify if the sqls are not dependet and written in MSR fashion (semicolon before the next sql)  it would execute all the SQLs in parallel in the same transient journal. (yes we need see if should fall under spool errros)

You must sign in to leave a comment.