Issue #1952. Index count optimization was removed and replaced by common index optimization because count optimization can work correctly for simple queries and can not work for queries which include inheritance or complex sql requests. As result after this change we still have fast count queries look at com.orientechnologies.orient.test.database.auto.SQLSelectIndexReuseTest#testCountFunction* methods (fixed in this change too) and do not have count issues when index is present.