I am working on a CSV data upload via email to apex where if the account record exists i need to get the Id and perform an upsert operation. I am using Map to capture all the accounts and checking if the account with that name exists.
Map<String, Id> accountMap = new Map<String,Id>();
for(Account a:[SELECT Name,Id FROM Account]){
accountMap.put(a.Name,a.Id);
}
System.debug(accountMap.size());
The above debug statement gives me a count of 4919.
However when i execute the following statement
System.debug([SELECT count() FROM Account]);
I get a total count of 5048.
I executed both in anonymous apex, but map count giving a different result.