Link to home
Start Free TrialLog in
Avatar of harsha_james
harsha_james

asked on

Impact of Order By on performance (Production Env.)

Hi All,
I am working on Data Migration Queries for migrating one version of product to another version, While writing data migration scripts I need to write scripts to fetch Before Data i.e. select required data before running Data Migration script and  After data i.e. select required data after running Data Migration script. (to verify before and after result in out file)

In before and after script I am using simple select statements without order by clause.
My query is ,
Can I use order by clause  for every select script as customer is going to run them on production environment, What will be impact on performance because of Order by Clause.
Will order by clause affect run time or memory utilization.
Many select statements return record count > 100000.
DB2 Version 9.1 on AIX

Avatar of theGhost_k8
theGhost_k8
Flag of India image

Ofcourse order by will cost some. You may check the impact using EXPLAIN.
and thats why there exists pages like: http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html
and
http://www.mysqlperformanceblog.com/2006/09/01/order-by-limit-performance-optimization/
ASKER CERTIFIED SOLUTION
Avatar of momi_sabag
momi_sabag
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial