What is the difference between DISTINCT and GROUP BY? They usually produce the same plan. Use GROUP BY for aggregates and DISTINCT to remove duplicates.
SQL SERVER – ReIndexing Database Tables and Update Statistics on Tables
ReIndexing Database tables with DBCC DBREINDEX and sp_MSforeachtable, then sp_updatestats to refresh statistics. Two scripts, including the one I prefer.





