I need to check the number of items in a collection without loading the full collection (as it has over 1.5 million items and causes memory issues).
Is there an efficient way to go about this?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
You can use getSize() method for this.
getSize() method execute a count SQL query into the database and give you the count.
You can read in detail by below article.