How different are user defined SQL and the generated SQL

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vcannadevula
Charter Member
Charter Member
Posts: 143
Joined: Thu Nov 04, 2004 6:53 am

How different are user defined SQL and the generated SQL

Post by vcannadevula »

Is there any performance difference if we use a userdefined sql as a generated SQL???
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Both run in the DBMS and hence there is no performance difference. The User Defined SQL can be enhanced by the developer to perform better.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

... and makes maintenance a PITA. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Craig,

What is a PITA?

Piece of cake...pity work....?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Pain in the Appendage :evil:
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Doh!! Unwanted question. Ignorant me. :oops:
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

User defined is usually slower because it is more complicated otherwise why not use the SQL builder in DataStage.
Mamu Kim
diamondabhi
Premium Member
Premium Member
Posts: 108
Joined: Sat Feb 05, 2005 6:52 pm
Location: US

Post by diamondabhi »

I know its not important but just wanted to add something that I learned recently.
If you are using DB2 plugin as a source or reference and ur using env variables as parameters then to view he data u need to select the user defined option to view the data.

Thanks,
Abhi.
vinod raj
Participant
Posts: 5
Joined: Mon Jun 27, 2005 10:58 pm
Contact:

user defined Sql query is one of the performance tunning tec

Post by vinod raj »

user defined Sql query is one of the performance tunning techique in DS. It is always a better option that generated one. you can use all type of oracle or any database inbuilt functions to the max extent thereby reducing the complexity of the job :D
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

I think you should use any type of SQL you are comfortable with from generated to SQL builders to user defined as long as you don't transform your data within the select statement. I always try to use generated first, when it becomes too complex I move to a SQL builder, my last resort is user defined. User defined does not synchronise the SQL select list onto the output column list making it higher maintenance.

Thowing in transform functions into a select list such as renaming columns, trimming and converting data may seem like a good idea at the time but these are primary functions of an ETL tool and should be put into the ETL job. Within a custom SQL statement they are largely invisible to metadata reporting tools such as MetaStage and they place extra load onto the RDBMS engine and they are more difficult to maintain. A new developer has to know both DataStage and the SQL scripting language to debug problems.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: user defined Sql query is one of the performance tunning

Post by chulett »

vinod raj wrote:user defined Sql query is one of the performance tunning techique in DS. It is always a better option that generated one. you can use all type of oracle or any database inbuilt functions to the max extent thereby reducing the complexity of the job :D
I'm with Vince and of the personal opinion that you're off base with the above advice.

You don't need User Defined SQL to tune a query. It's always my technique of last choice and prefer column generated where possible. Minimize the arcane database functions you use in your SQL for precisely the reasons Vince notes.

But as I said, that's just my opinion. Different strokes...
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I agree with Craig. Keep it simple unless some strong need changes it.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's really quite amazing what you can do with generated SQL if you put your mind to it. All you have to realize is:
  • the Derivation column on the Columns tab becomes the SELECT clause (so you can include set functions in the derivations)

    the Table name becomes the FROM clause, so you can use comma-separated lists for inner joins (or Cartesian products!) or you can include full specification of joins such as TableA LEFT OUTER JOIN TableB ON TableA.ProdCode = TableB.ProdCode

    you can put whatever you like into the other, optional, clauses on the Selection tab
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply