Sequential Execution of the Stmts within the Macro

Database

Sequential Execution of the Stmts within the Macro

well i am having a qyery Regarding Teradata Macros.

As far as i know Statements (Teradata SQL) Within the Macro are executead as a Single Multi Statement Request and Individual Statement can be executed Parallelly within Multistatement Request.in That case how the Sequentiality of the SQL Statement Assured ? There can be a Scenario where Second Statement Executed Faster than the First Statement .As far as the SP goes it the Cursor Logic so Sequentiality is maintained.Need to clarify the same for Macro.

Regards
9 REPLIES

Re: Sequential Execution of the Stmts within the Macro

I think only those statements which are independent of each other (in terms of outcome) are executed in parallel. Otherwise they would be executed sequentially.

Re: Sequential Execution of the Stmts within the Macro

Thanks for the Reply Joe.

well That means Optimizer Determine which statements are totally independant of each other in terms of the outcome at parsing time and execute them parallelly.so All the statements will be examined within a Macro to figure it out weather any deal of parallalisam is possible.

Correct me if i am wrong.

Regards
Abhijit

Re: Sequential Execution of the Stmts within the Macro

In fact, one of the criteria that any distributed computing platform has to satisfy while translating the input instructions to a set of internal parallel execution instructions is to preserve it from any such "side effects" that might arise. (Duh!, that's all I can remember about a paper for which I buried my head for a whole semester :o )

Re: Sequential Execution of the Stmts within the Macro

Thanks Joe.

Re: Sequential Execution of the Stmts within the Macro

Hi Abhijit,
As from point of view Jose is right....

thanks
Teradata Employee

Re: Sequential Execution of the Stmts within the Macro

So, if a macro has multiple INSERT statements into the same table, are they all INSERTed at one time (as a multistatement request), or are they INSERTed sequentially?

Re: Sequential Execution of the Stmts within the Macro

If they are singleton inserts (as opposed to insert/select), they should all happen in parallel.
Teradata Employee

Re: Sequential Execution of the Stmts within the Macro

They are INSERT/SELECTs. Merging several tables into one. I want to avoid transaction journaling and have them all treated as a single INSERT into an empty table.

Re: Sequential Execution of the Stmts within the Macro

They may not execute in parallel (parallel steps in the explain), but they should avoid transaction journaling provided the table was empty when the macro was called and no other statements that affect that table are above the insert/selects.

If you do an explain on the "exec macro" statement, it should show the results from the two selects going into a common spool file if the statement is going to avoid transaction journaling.