Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

wrong estimation

$
0
0

I have created filtered index on table:

CREATE NONCLUSTERED INDEX [ix_test] ON [dbo].[myTable]
(col0 ASC)
INCLUDE (col1) 
WHERE (col2 IN(1,2,3))
ON [PRIMARY]
GO

col2 is TINYINT data type.

Then i have query like this:

SELECT col1 FROM dbo.myTable WHERE col2 IN(1,2,3)

From execution plan I can see, that my filtered index was used as expected. But estimated number of rows is 8280, actual is higher, 9507. Because of wrong estimation, I get sort warning (in my real query).

How should I repair estimations? There is index statistic created by default, but should i create some other statistic?

br, Simon


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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