Most Important Missing Indexes

--Most important missing indexes.
--works across all databases. 
--only need to run once/day
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT TOP 25 
    ROUND(s.avg_total_user_cost *
            s.avg_user_impact                            
                    * (s.user_seeks + s.user_scans),0) AS TotalCost
    , d.[statement] AS TableName
    , equality_columns
    , inequality_columns
    , included_columns
FROM sys.dm_db_missing_index_groups g
JOIN sys.dm_db_missing_index_group_stats s
    ON s.group_handle = g.index_group_handle
JOIN sys.dm_db_missing_index_details d
    ON d.index_handle = g.index_handle
WHERE d.database_id NOT IN (select database_id from sys.databases WHERE name IN ('master','distribution','msdb')) 
ORDER BY TotalCost DESC