Good afternoon,
I'd like to know what you guys think about this performance question. In order to describe it well, I'll layout a simlpe table, and query, and I'll explain the question after that.
[Table: Categories]
Id [PK]
Alias NVarChar(50) [ASC Index]
[Stored Procedure Query]
SELECT C.IdAS Id,C.AliasAS CategoryFROMCategories CORDER BYC.AliasASC;
My question is simple. Let's supose we are getting a good sum of rows, like 10.000, to fill out a list. Even though that wouldn't be the best practice, because we should implement some sort of paging, we'll just ignore that fact for the sake of simplicity.
The question is: What would perform better? The query that I've writen above or a query that was exactly the same but instead of having Order By C.Alias ASC we would have Order BY Category ASC (being Category an alias created in the select statement)?
I know this might be seen as a dumb non-sense question... But still, I was just wondering if anyone knew the answer.
Best regards,
DBA
Hi,
the Index will do the job?
with proper indexing, the result will be noticible
with no index and ordering sorting will suffer
IMHO
No comments:
Post a Comment