• As it is selecting 20 million records, its obvious that it effects the performance of other transactions on the server as the tempdb will be heavily loaded.

    1. Make sure nolocks are maintained on the tables from where the data is getting selected

    2. check the where clause is having the columns which are indexed

    3. Check the query execution plan in the dev server for confirming there are no table scans(if table scans are there, then add indexes on the required columns)