Regarding how to solve Teradata 2631 Deadlock issue

Hi Folks,

Am working a Complex query consisting of 800 Lines of Code, it is built on Teradata SQL Functions/Joins and basically a reporting SQL. Have a requirement to be able to run this Teradata SQL Functions on Starburst Enterprise. Which I was able to run until 60 Elements of Teradata were used. The moment more Elements were added into this SQL , The Result set started failed within a span of 23s ,giving message " 2631 transaction aborted due to deadlock"

Have also optimized the query , by the way of using CTE(Common Table Expression) and my new query returns a row of 1 record in span of 7s which I believe is good speed,

I want to understand the same query works on Teradata Studo Express , but fails to return the resultset as soon as more Elements to added to its query. Can you pls explain how to resolve this.

Can I try using LOCKING ROW FOR TABLE ACCESS . Will this work?