Time Out waiting for mutex

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

Tatiana
Participant
Posts: 18
Joined: Tue Jul 15, 2003 3:23 pm

Post by Tatiana »

rwierdsm wrote:The database will be much, much faster then DataStage.

Rob
If I'm pulling data directly from a table I'll need to switch to pull the data from a sorted view, right?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You dont need to switch to anything. The orderby clause will give you the data in the sorted order.
Is that what you meant or am i going cukoo?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Tatiana
Participant
Posts: 18
Joined: Tue Jul 15, 2003 3:23 pm

Post by Tatiana »

Thanks, DSguru for all your help. I did add order by clause in the select statement in Oracle stage. In my question I was referring to rwierdsm's statement that it will be much faster in database then DataStage ("If you can do the sort as part of your database read, do it there! The database will be much, much faster then DataStage.").
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Post by rwierdsm »

Tatiana,

No view required, simply add an order by clause, as below

Before:

Code: Select all

Select ColumnA, ColumnB, ColumnC
 From Table1
After

Code: Select all

Select ColumnA, ColumnB, ColumnC
 From Table1
 order by ColumnA, ColumnB
You can do this by setting the database stage to either 'User Defined SQL', or 'Generated SQL' and specifying your sort criteria in the proper place.

Craig,
Actually, asserting the 'sort' order in the Aggregator is required or else all your database sorting will be wasted.
?!?!? I've used the aggregator after a sort without specifying any sort criteria. Am I writing buggy code?!?

Rob
Rob Wierdsma
Toronto, Canada
bartonbishop.com
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well by specifying the sort order to the aggregator, the aggregator becomes much happier as it can blindly group by those keys without actually storing much info in the temp files. The aggregator becomes much faster (kinda like a super charged car 8) ) when it knows how the data is coming in.
And no my name is not Chuck. :twisted:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not buggy, per se - but you are making it do more work than necessary. :P

If you do not assert a sort order in the Aggregator stage, it has no idea what order the incoming data is in. It then errs on the side of caution and so needs to take all of the incoming data into the stage, order and then aggregate it. That's why you see everything go in before anything starts coming out.

When you mark those sort fields in the Aggregator, you aren't telling it how to sort the data but how the incoming data is sorted - hence my use of the term 'assert'. And much like a normal assertion, if you lie to the stage it will bust you for it with an Abort for 'row out of sequence'.

If you get it right - presort in a manner that supports the aggregation being done (another key point) and assert that sort order in the stage - it is no longer a 'bottleneck'. It basically only needs to hold one 'aggregation group' in memory at a time and when the first record from the new group comes in the old group is flushed through.

Hope that makes sense...
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Isnt that what i said :roll:
Well, Craig gave more grace to it. Well explained.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Post by rwierdsm »

chulett wrote:Hope that makes sense...
Perfect sense!

As it turns out, the places where I've done this has pretty low volumes, so it will be OK in the interim.

Thanks, guys (as I mutter something about old dogs learning new tricks...)
Rob Wierdsma
Toronto, Canada
bartonbishop.com
Tatiana
Participant
Posts: 18
Joined: Tue Jul 15, 2003 3:23 pm

Post by Tatiana »

Thanks for your help with the sort suggestion. After I added sorting, the job did run without the mutex error message. However, now with the sort it takes almost twice as long as before. Do you have any ideas on improving the performance?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is there an index on the sorting column?

Because a B-tree is stored in sorted order, it can facilitate sorting in an unconstrained query, and in certain classes of constrained query.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Tatiana
Participant
Posts: 18
Joined: Tue Jul 15, 2003 3:23 pm

Post by Tatiana »

ray.wurlod wrote:Is there an index on the sorting column?
Does it matter if I'm getting data from a view or table? I'm pulling the data from an Oracle view.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

View should point the table while retriving data, and inturns the index.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply