title: Count(*) with NText column is very very very slow. Why is it so slow? And how can I improve performance?
body: <p>I've got some problems with my SQL Server 2005 database. I've got a table with order lines and every line has an <code>NTEXT</code> field named <code>XmlData</code>. I want to count all the fields that have no information stored in them. I'm using this query:</p>
  
  <pre><code>SELECT Count(*) FROM [OrderLine] WITH(NOLOCK) 
  WHERE [XmlData] NOT LIKE '' AND [XmlData] IS NOT NULL 
  </code></pre>
  
  <p>The table has 230.314 of records and this counting query it takes several minutes. Do any of you guys have a clue as how to increase performance?</p>
  
  <p>Note: I can't change to type of the column to <code>nvarchar(max)</code> type. The NOLOCK was a tip of a colleague.</p>
  
  <p>I'm looking forward to some tips and explanations.</p>