There are three types of cardinality
- High Cardinality
- Normal Cardinality
- Low Cardinality
Cardinality estimator is redesigned in sql server 2014. One can test the query performance by just altering COMPATIBILITY_LEVEL parameter of database.
COMPATIBILITY_LEVEL -> 110 (SQL 2012)
COMPATIBILITY_LEVEL -> 120 (SQL 2014)
Note: even though we've got sql server 2014 engine, the compatibility level of database is to be set to 120 i.e. sql 2014.
I'm using Adventure works 2012 database, just altered the compatibility from 110 to 120 and brummm !!! see the performance:
-- Query 1
ALTER DATABASE AdventureWorks2012
SET COMPATIBILITY_LEVEL = 110
GO
exec [dbo].[uspGetEmployeeManagers] 10
go
-- Query 2
ALTER DATABASE AdventureWorks2012
SET COMPATIBILITY_LEVEL = 120
GO
exec [dbo].[uspGetEmployeeManagers] 10
go
For Further information:
Doc Ref: http://msdn.microsoft.com/en-us/library/dn600374.aspx