Archives of the TeradataForum
Message Posted: Thu, 04 Sep 2003 @ 21:22:31 GMT
Subj: | | Re: Rank top and bottom |
|
From: | | Figge, Jason |
You could try the following:
SELECT Fields
FROM Table
QUALIFY RANK(Field1) < 11 OR
RANK(Field1 ASC) < 11
The difference between the two statements is that the UNION version would result in a 'Redistribution by hash code' and the double RANKed
statement causes an 'assumed redistribution by value'. I'm guessing the later means that no data has to move (can someone confirm or deny
this?). Also, if you have indexes defined and they were in use with the UNION statement, check that the introduction of the OR predicate
hasn't caused a FTS (may or may not be slower).
Jason
|