• this is the query plan without the non clustered index which produced 9 table scans

    |--Compute Scalar(DEFINE:([Expr1003]=CONVERT_IMPLICIT(int,[globalagg1005],0)))

    |--Stream Aggregate(DEFINE:([globalagg1005]=SUM([partialagg1004])))

    |--Parallelism(Gather Streams)

    |--Stream Aggregate(DEFINE:([partialagg1004]=Count(*)))

    |--Clustered Index Scan(OBJECT:([Wallet0000].[dbo].[EntityCollection].[PK_Entity]))

    this is with the index i added

    |--Compute Scalar(DEFINE:([Expr1003]=CONVERT_IMPLICIT(int,[Expr1004],0)))

    |--Stream Aggregate(DEFINE:([Expr1004]=Count(*)))

    |--Index Scan(OBJECT:([Wallet0000].[dbo].[EntityCollection].[idx_entity_identifier]))