Why go for sort within groups?

We have sort and sort within groups components. we can achieve the sort within group functionality by placing two keys in sort group. Then why we have to go for sort within groups?

Questions by prabhupurna   answers by prabhupurna

Showing Answers 1 - 34 of 34 Answers

mukund

  • Sep 15th, 2006
 

Hi

 sort with in groups refines the data which is already sorted according to a key.ie it regroups the data ,which is already grouped with a key.but using sort we cannot achieve this.

cheers

Mukund

Xansa(India)Ltd

  Was this answer useful?  Yes

vinay

  • Sep 16th, 2006
 

Hi mukund,

       you are given answer about group sorting its not clear explain clearly?

  Was this answer useful?  Yes

sivaprasad

  • Sep 20th, 2006
 

HI , Mukund i am sivaprasad from hyderabad, u r given answer to that question verynice, i would like to talk to u .once give me responce.

  Was this answer useful?  Yes

sivaprasad

  • Sep 20th, 2006
 

hi mukund , i am sivaprasad, this is my mail id; sivaprasady@gmail.com ,once i would like to talk to u,give me mail responce thank u.sivaprasad

  Was this answer useful?  Yes

dontbuckme

  • Sep 22nd, 2006
 

The prerequisit for using sort within group is the data is already sorted by the major key. 

Sort within group can output the data to the out flow once it has finished reading the major key group.  It allows data streamline flow.  Conversely, sort will not output the data until all input data has been read, so it is like a implicity phase.

  Was this answer useful?  Yes

phaneendra

  • Oct 11th, 2006
 

That is exactly nice which is said by Mr.mukund

  Was this answer useful?  Yes

Use Sort within Groups only if records within a group are processed before being sorted on a minor key i.e. if processing "A" needs records to be sorted on field {"1"} and later in the flow processing "B" needs records to be sorted on field {"1", "2"}. in this case before processing "2" and after processing "1" use sort within groups with major-key as {"1"} and minor key as {"2"}.

If records are not grouped to start with, use Sort with a multi-part key. There is no benefit to using Sort within Groups directly after using a Sort component.


- Manish

  Was this answer useful?  Yes

Sort with in group sort the data based on major & miner key in single time.

Sort component sort the data on a single key at a time.If we have sort with some other key again we have to use the sort component again.It take some extra time. That sort with in group using best way.


  Was this answer useful?  Yes

ram

  • May 10th, 2013
 

Usually when we use sort within groups we can sort the data by universally in the sense we can make sure pure sort by using defined keys....but if we use only sort we cant decide data dynamically and to again sort with another key the component time is increased graph complexity increases ..so sort with in groups is perfect to sort data dynamically

  Was this answer useful?  Yes

pritam sahoo

  • Nov 20th, 2013
 

first sort breaks pipeline parallelism but sort with in groups does not break. second thing is that sort with in groups being used when you know that the first key is already been sorted,if you use sort with two key then it will again sort on the first key so the over all performance will be downgraded.

Munmun

  • Mar 31st, 2015
 

Sort within group is used to sort records on the minor key which is already sorted on major key.
For Example:
Let us suppose my data is coming like
Dept_Num, Proj_Num, Manager
-------------------------------------------
10, A, Prabha
10, C, Ajit
10, B, Sujata
20, D, Feraz
20, A, Prabha
20, E, Tanmoy
30, A, Prabha
30, C, Ajit
30, B, Sujata
20, D, Feraz
20, K, Munmun
20, E, Tanmoy
These records passed from sort within group having major key dept_num and minor key proj_num then output will be
10, A, Prabha
10, B, Sujata
10, C, Ajit
20, A, Prabha
20, D, Feraz
20, E, Tanmoy
30, A, Prabha
30, B, Sujata
30, C, Ajit
20, D, Feraz
20, E, Tanmoy
20, K, Munmun

sundar

  • May 5th, 2015
 

Hey Munmun,
Do we need sorted data to sort with in group or component will taking care?
Thanks

  Was this answer useful?  Yes

Mahesh

  • May 26th, 2021
 

One of the other examples could be :
graph A has done PBKS on field A
and when the output of graph A is being read by graph B it needs data to be sorted on fieldA and fieldB so major key is fieldA and minir key is fieldB.This saves time and increases performance.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions