Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Sorting -which is the good candidate

Author  Topic 

venkath
Posting Yak Master

202 Posts

Posted - 2009-01-07 : 12:33:57
Hi all

Please clarify me on the following
In an Order by clause of a query, which column should be prefered and why?

- Sorting on Duplicate data string column
- Sorting on Duplicate data numeric column
- Sorting on unique numeric column

And also please let me know whether having an index on sorting column improves the performance?


Thanks

revdnrdy
Posting Yak Master

220 Posts

Posted - 2009-01-07 : 12:39:44
Generally speaking a computer can sort integer data faster than string data. A computer has to do additional comparison and conversion on string data which slows down the processing. As the dataset (# of records) increases this becomes more prolific.

Also using indexing can vastly improve performance. However you would need to evaluate an indexing scheme for your particular database table (such as clustered vs non-clustered).

I am sure more detail can be provided by other posters as necessary.

r&r
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-07 : 12:41:06
We can't answer that first question as how you sort is dependent upon your business requirements. You sort on what is required by your customers and application.

An index should help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -