Archives of the TeradataForum
Message Posted: Wed, 20 Feb 2008 @ 21:09:39 GMT
I believe that the difference is that the first one does not have a column name (alias) for the database to refer to when you specify 1 in the order by. But of course the real question is why would you sort on a constant when they are all the same. It does not make sense. It does not make a difference in the final sequence and it does use more spool. Why use more resources and slow your query down for no apparent reason?
If you want to talk about wasted resources, why are you doing a group by on a literal? That makes no sense either because they are all the same. Hopefully the optimizer is smart enough to figure out that you are wasting more resources.
I would be disappointed if the first one did not throw an error and I am also a little disappointed that the others didn't throw back an error too or at least FIX your query to be less wasteful of spool and redistributions.
Just my observation,
|Copyright 2016 - All Rights Reserved|
|Last Modified: 23 Jun 2019|