Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Weird or unexplained SQL Index behavior

$
0
0

I've seen enough Stack Overflow threads to know to get these one out of the way:
SQL Server 2014 SP3 CU3 Enterprise. Database is Mirrored. Table has about 180 million rows.

As the title suggests I have some index issues on a database that a vendor created.

All of my testing of indexes are runs of a variant of the following query;

SQL
SELECTE.Account,E.Date,E.Code,E.Evt,E.DescFROMdbo.EventEWHEREE.dateBETWEEN'2019-02-01 00:00:00.000'AND'2019-02-02 00:00:00.000'

The only things I change are the dates in the WHERE clause. For the purposes of testing, I have non-clustered indexes on dbo.Event.Date (datetime, not null) and dbo.Event.AccountID (int, not null).

In testing, if I run the above query DB Engine does an index seek and everything is fast and happy.

Now's where it gets weird and I do not understand the behavior:

  • Run the same...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>