Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Parameter substitution to allow Explain - forum topic by TGooch44

$
0
0

Is there anyway to get what parameter a given query is using, so that it's possible to explain the query?  Contrived example of what I'm talking about(syntax may not be 100% correct):
CREATE PROCEDURE whatever(
IN someDate DATE,
IN numDays INT,
)
BEGIN
DECLARE currDate DATE;
DECLARE loopCnt INT;
SET currDate=someDate;
SET loopCnt=0;
WHILE loopCnt < numDays
DO
 INSERT INTO this_table
SELECT col1, col2, sum(col3)
FROM that_table
WHERE part_col = someDate + loopCnt
GROUP By 1,2;
SET loopCnt = loopCnt + 1;
END WHILE;
END;
Now, the above will have something like this in Viewpoint/QryLog/PMPC API calls as the QueryText:
USING
 
INSERT INTO this_table
SELECT col1, col2, sum(col3)
FROM that_table
WHERE part_col = someDate + loopCnt;
SET loopCnt = loopCnt + 1;
_spVV8 (DATE),
_spVV9 (INT) INSERT INTO this_table
SELECT col1, col2, sum(col3)
FROM that_table
WHERE partCol = :_spVV8 + :_spVV9;
Is the value for :spVV8 and :spVV9 stored anywhere that I can query while the query is inflight? Alternatively, did I miss or is there an undocumented API for getting the full-explain text or XML explain for inflight queries?  The closest seems to be MonitorSQLSteps, but it only has partial step text.  But, it must be available somewhere since Viewpoint(and previously TD Manager) have it in their Query Explain Display.  
Thanks in advance

Forums: 

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>