I have a MS SQL table with about 8 million records. There is a primary key (with clustered index with only 0.8% fragmentation) on the column “ID”. When I run seemingly any query referencing the ID column, the query takes very long (and in fact ultimately crashes my application). This includes simple queries like “SELECT * FROM table WHERE ID=2020”. By contrast, queries that do not reference ID (such as “SELECT TOP 100 * from table”) are just fine.
Any ideas?
If the query is taking 10 minutes(!?!) you’ve got something seriously wrong. Even a table scan of 8 million records should take only a second or two. I would check the event log for an indications of imminent hardware failure, or try moving the database to a different server to see if there’s some other hardware fault.