I am using the following query in beforeUpdate and after insert:
SELECT OwnerId ownerIdVal, Count(Id) oppCount FROM Opportunity WHERE OwnerId IN: ownerIdSet AND lastmodifieddate > 2016-01-01T00:00:00.000+0000 AND StageName IN:oppStatusSet GROUP BY OwnerId
Will Salesforce not make it non-selective since it is having a WHERE clause on OwnerId? I tried this in fullcopy sandbox and not hitting any error. Please let me know if you see any issues with this.