Hi,
What are the things that I should look for when a stored procedure takes more time to execute than usual.
I understnd that stale stats can be the primary issue for such occurences but apart from that can there there be any other issues which can be resolved?
Thanks,
Gordon
Stored Procedure taking more time than usual - forum topic by gmathias
Non duplicate row selection query - response (17) by johnsunnydew
Non duplicate row selection query - response (18) by dnoeth
You need to install a hash function, hash_sha512 doesn't exist on your system.
Execute a set of DDL's as a single script - response (1) by dnoeth
You're running CREATEs without prior testing?
Why don't you check the DDLs in a development database?
Using Case statement instead of Union - response (1) by dnoeth
Why don't you want utilize UNIONs?
For CASE you need to cross join to a table containing one row per column, e.g. n = 1,2,3,4
select case when helper.n = 1 then C1 when helper.n = 2 then C2 when helper.n = 3 then C3 when helper.n = 4 then C4 end as C from tab cross join helper where C is not null
Bug in exponentiate ** operator precedence and associativity ? - forum topic by pjozwiak
Consider below query:
SELECT 2**3**4
as a result teradata returns value of expression 4096. This means that provided expression was calculated in this way:
//Teradata left associative (probably wrong): ((2**3)**4) = 4,096
But this is wrong !
When expression contains operators with same precedence then normally expression is evaluated from left - to right. But exponentiate operator is evaluated from right to left.
This means that presented expression should be evaluated in this way:
//Google and Mathematical theory says that 2**3**4 is right associative (2**(3**4)) = 2,417,851,639,229,260,000,000,000
Try to evaluated this expression in for ex. google. Expression is evaluated from right to left. Also wikipedia describes this problem in this articel: http://en.wikipedia.org/wiki/Operator_associativity in same way as google evaluates this kind of expressions saying that operator is right associative.
Why Teradata is evaluating this operator from left to right ? Is it just a bug or intended behaviour?
Bug in exponentiate ** operator precedence and associativity ? - response (1) by dnoeth
The manuals clearly specify the left-to-right order, so at least it's documented behaviour :-)
I tend to use brackets, so there's no gueass about order...
Btw, your expected result is wrong.
Google returns an approximate result, 2.4178516e+24, and (2**(3**4)) is actually not 2,417,851,639,229,260,000,000,000 (Teradata returns FLOATs for exponentiation) but 2,417,851,639,229,258,349,412,352.
when a new user s created,few databases are assigned to the user by default. - forum topic by GuruViswanath
Stored Procedure taking more time than usual - response (1) by MaximeV
hello,
Could be lock issues. Do you query tables or views?
Transpose from columns to rows - response (2) by nileshbhaw
you are awesome Dieter Thanks :)
Just wanna make sure , In the subquery you used Max function I guess it does not matter we use Max or Min? Is that right?
Execute a set of DDL's as a single script - response (2) by KVB
Yes.Those statements will be checked in DEV and QA.But as part of the automation process,we prior check and execute.
We have all the create statements in one file and DML's in another.While placing them in files,there are chances of copy/paste mistakes.
That's the reason we are trying to do this.
Any help in this regard is appreciable.
Stored Procedure taking more time than usual - response (2) by teradatauser2
If there is an insert/update, please check if the data is not skewed i.e it is being inserted/updated to only few amps.
--Samir
Execute a set of DDL's as a single script - response (3) by teradatauser2
Did you weigh the option of using BT ET in Teradata mode in bteq? If any one of them fail, both will roll back. You need to check if DDLs are allowed in this.
.LOGON
BT; (txn #1)
INSERT row1;
INSERT row2;
ET;
.LOGOFF
REGEXP_SIMILAR Syntax - response (3) by lecslecin
I got some clue from other thread where drop stat not working in SQL Assistant 15.0, same problem is with REGEXP_SIMILAR function too. I am able to run this function in BTEQ.
Thanks Dieter for help in either threads.
Transpose from columns to rows - response (3) by dnoeth
Of course not, '' is less than 'F' :)
Using Case statement instead of Union - response (2) by sbadnikar
Thanks for your reply @dnoeth !
I didn't want to use union because I was running out of spool space while using 3 unions.
I'll try to optimise the union query and collect some stats to see how it goes.
Using Case statement instead of Union - response (3) by dnoeth
Collect Stats will not help for UNION (or CASE).
Do you really need a UNION instead of UNION ALL?
This will add a DISTINCT step with a lot of overhead, distribution & sort.
And you must add DISTINCT to the CASE version, too.
Or you simply ask your DBA to increase your spool limit.
Is there a way to make column aliases or titles longer? - ideally 256 characters. - forum topic by Tim_Manns
I'm migrating data from an analytics platform (in this case SAS) exporting the datasets into Teradata tables that I create.
I can successfully create column names and column titles, but the source column/variable titles are longer than 60 characters (it seems the limit in Teradata is 60 characters). I have to truncate the column titles before creating the table in Teradata to avoid error. I've done this succesffuly, but I don't want to :) I want the full column description in the column title.
Any way I can attach column descriptions (titles, aliases etc) to a column that can be much longer, say 256 characters?
Thanks
Tim
Unwanted databases gets assigned whenever a new user is created. - forum topic by GuruViswanath
Hi,
I am facing an issue while creating an user. There are few databases which are assigned(user holds certain accesses on the databases) to the user without even granting the access. I don't want the users to hold the accesses to those databases without DBAs granting it. Please help me to resolve the issue.
Thanks
Is there a way to make column aliases or titles longer? - ideally 256 characters. - response (1) by dnoeth
Hi Tim,
hopefully you never have to key in your column names :-)
Seems you run on a version before TD14.10 which only supports only 30 characters for column names and 60 for titles.
TD14.10 adds extended object names up to 128 chars and 256 for titles.
Only COMMENTs can be up to 256 chars, but then you still need to shorten the actual name...
Hi Dieter,
Thanks. Just executed and it throws out with the error 3706. Expected something between ( and the Trim keyword.
select * from CONSUMER_TABLE
WHERE DIRCT_ID IN
(select min(DIRECT_ID)
from CONSUMER_TABLE
GROUP BY hash_sha512(TRIM(PROCESS_DATA_MONTH) || '.' ||
TRIM(GEOGRAPHY_CODE) || '.' ||
TRIM(PRODUCT_NAME) || '.' ||
TRIM(VARIABLE_NAME) || '.' ||
TRIM(TIME_PERIOD) || '.' ||
TRIM(VARIABLE_QUANTITY) || '.' ||
TRIM(OUTLET_NAME) || '.' ||
TRIM(BRANDED_UNBRANDED) || '.' ||
TRIM(CAMPAIGN_ID) || '.' ||
TRIM(VENDOR) || '.' ||
TRIM(CHANNEL_NAME) || '.' ||
TRIM(ACTIVE_FLAG) || '.' ||
TRIM(CREATED_DATE) || '.' ||
TRIM(IMS_NUMBER) || '.' ||
TRIM(GEOGRAPHY_ID) || '.' ||
TRIM(TIME_ID) || '.' ||
TRIM(AR_CUSTOMER_ID) || '.' ||
TRIM(CUSTOMER_ID) || '.' ||
TRIM(AR_PRODUCT_ID) || '.' ||
TRIM(PRODUCT_ID) || '.' ||
TRIM(INDICATION) || '.' ||
TRIM(PROGRAM_NAME) || '.' ||
TRIM(PROGRAM_CODE) || '.' ||
TRIM(MEDIA_SHOW_TIME) || '.' ||
TRIM(PROGRAM_DURATION) || '.' ||
TRIM(MEDIA_TYPE) || '.' ||
TRIM(CAMPAIGN_NAME) || '.' ||
TRIM(PLACEMENT_NAME) || '.' ||
TRIM(VARIABLE_DESCRIPTION) || '.' ||
TRIM(CHANNEL_ID) || '.' ||
TRIM(MARKET_IDENTIFIER) || '.' ||
TRIM(PRODUCT_IDENTIFIER) || '.' ||
TRIM(ABBREVIATION) || '.' ||
))