![]() |
|
Archives of the TeradataForumMessage Posted: Thu, 08 Sep 2016 @ 19:30:30 GMT
<-- Anonymously Posted: Thursday, September 08, 2016 09:54 --> Dear Forum, Is there a better way to rewrite the below query? This delete is skewed and the impact cpu is at least 50 times more than the sum(cpu).
DELETE FROM
DB1.TAB1_stg? A
DB1.TAB2 B
WHERE A.id=B.id
AND A.Y1=B.Y1
AND A.Z1=B.Z1
AND A.XYZ=B.XYZ
AND A.PQR=B.PQR
AND A.MNO=B.MNO
AND A.DATE < B.DATE
AND A.IJK=B.IJK
tab1_stg: PI: ( id ,y1 ,z1 ,xyz ,pqr ); - Stage table.
Count - 5million
Tab2: PI: id
count - 300million
Both the tables are slightly skewed.? Stats are existing on PI and join columns. Is there a better way to rewrite this query or should the PI of stage table be same as tab2 or viceversa as the structure of both the tables is same? Appreciate your response!
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | https: | |||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 24 Jul 2020 | ||||||||||||||||||||||||||||||||||||||||||||||||