|
|
Archives of the TeradataForum
Message Posted: Mon, 20 Jul 2009 @ 15:46:58 GMT
Subj: | | Re: Macro use with Work Tables |
|
From: | | Victor Sokovin |
| The change from Procedure to Macro with trivial, just topping and tailing the wrapping code, as the rest of it was just a series of
Insert/Select statements. | |
| Basically what those Insert/Select do is splitting down what would otherwise be an horrendously complicated statement into more manageable
chunks. So It writes some data into a 'work' table and then uses that 'work' table in the next step, joining to some other table in the
process. | |
| Thing is, the Insert/Select uses a set of 'work' tables (actually they Exist in Perm space) and clear them down at the end of the Macro.
This seems to have had the affect that, within the Explain Plan, there are no available Stats for the Macro to work with. | |
One difference with macros is that the statements are executed as multi-statement request. The individual statements may be simple and their
execution in correct sequence as in a BTEQ script does not present any problems but when all of a sudden they are executed in parallel the logic
may actually complicate quite a bit and even change into incorrect logic and lead to incorrect end results.
Have you inspected the new MSR logic from this perspective? Perhaps you should do it and then you will come with the solution of splitting the
original script into a few macros or something.
Victor
| |