concept impact in category sql

This is an excerpt from Manning's book SQL Server MVP Deep Dives Vol. 2.
I’ve seen numerous cases where the DBAs and developers admit that there are serious flaws in the database design (“I inherited it this way”), but they’ll probably have to live with those flaws for many years to come. Their very valid reason is that the original design was created many years ago when the design characteristics, now recognized as flaws, had little or no negative impact. Since then, the natural evolution and expansion of the database have magnified the impact of those flaws. If the original designers had known the true extent of the resources that would be spent as a direct result of their design flaws, I’m sure they would have taken the time to think things over once more.
Of course, there’s trickery going on here. I’m adding a column that’s already known to be unique. Because the query optimizer knows that the Name column is already unique, it realizes that the combination of Name and Color must also be unique. Applying an operation couldn’t make it anymore unique—there aren’t degrees of uniqueness. Notice that the unique index isn’t even being used here, but if you remove it temporarily, the impact is significant, as shown in figure 5.
Listing 1. Querying the plan cache for missing indexes
WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/sqlserver/2004/07/showplan') ,PlanMissingIndexes AS ( SELECT query_plan, cp.usecounts FROM sys.dm_exec_cached_plans cp OUTER APPLY sys.dm_exec_query_plan(cp.plan_handle) tp WHERE tp.query_plan.exist('//MissingIndex')=1 ) SELECT stmt.value('(//MissingIndex/@Database)[1]', 'sysname') AS database_name ,stmt.value('(//MissingIndex/@Schema)[1]', 'sysname') AS [schema_name] ,stmt.value('(//MissingIndex/@Table)[1]', 'sysname') AS [table_name] ,stmt.value('(@StatementText)[1]', 'VARCHAR(4000)') AS sql_text ,pmi.usecounts ,stmt.value('(//MissingIndexGroup/@Impact)[1]', 'FLOAT') AS impact ,stmt.query('for $group in //ColumnGroup for $column in $group/Column where $group/@Usage="EQUALITY" return string($column/@Name) ').value('.', 'varchar(max)') AS equality_columns ,stmt.query('for $group in //ColumnGroup for $column in $group/Column where $group/@Usage="INEQUALITY" return string($column/@Name) ').value('.', 'varchar(max)') AS inequality_columns ,stmt.query('for $group in //ColumnGroup for $column in $group/Column where $group/@Usage="INCLUDE" return string($column/@Name) ').value('.', 'varchar(max)') AS include_columns ,pmi.query_plan FROM PlanMissingIndexes pmi CROSS APPLY pmi.query_plan.nodes('//StmtSimple') AS p(stmt) ORDER BY stmt.value('(//MissingIndexGroup/@Impact)[1]', 'FLOAT') DESC

This is an excerpt from Manning's book SQL Server DMVs in Action: Better Queries with Dynamic Management Views.
Typically, when you query the DMVs to extract important diagnostic information, this querying has a minimal effect on the server and its resources. This is because the data is in memory and already calculated; you just need to retrieve it. To further reduce the impact of querying the DMVs, the sample code is typically prefixed with a statement that ignores locks and doesn’t acquire any locks.
There are cases where the information isn’t initially or readily available in the DMVs. In these cases, the impact of running the query may be significant. Luckily these DMVs are few in number, and I’ll highlight them in the relevant section. One such DMV is used when calculating the degree of index fragmentation (sys.dm_db_index_physical_stats).
Knowing where a given SQL query is used is useful when examining the impact of changes or when you want to gain a better understanding of a system. For example, you might want to know where a given table is updated or inserted into or which stored procedure contains a given line of SQL or text. The cached plan supplied with the output should prove useful in helping you improve the query’s performance.