title: MS SQL Server 2012 extremely slow information_schema query
body: <p>We are using MS SQL Server 2012 , we have this extremely slow query that selects data from the information_schema , after some analysis we found that the root cause of the slowness is a join that selects from the KEY_COLUMN_USAGE view . </p>
  
  <p>I tried to select the count from that view using the following statement :</p>
  
  <p><strong>select count(*) from INFORMATION_SCHEMA.KEY_COLUMN_USAGE</strong> </p>
  
  <p>and it took 7 hrs to return the result (About 75 000 rows ) .</p>
  
  <p>This is only happening on one of the databases , on the other databases (on the same server )  , the same query takes less than 3 seconds !  </p>
  
  <p>What might be the root cause of this ?</p>