One application causes a heavy load on our Sql Server 2005 database. We don't control the application that runs this query hundres of times a minute:
select id,col1,col2,col3 from table where id != id
Note the id != id, meaning a row is not equal to itself. Unsurprisingly, the result is always no rows found. However, Sql Server does a clustered index scan scan every time it runs this query!
The id column is defined as:
varchar(15) not null primary key
The query plan shows a huge number for "Estimated Number of Rows". Does anyone have an idea why Sql Server needs the table scan to figure out the obvious?