For example:
SELECT UserID, count(*) FROM Messages WHERE UserID IN (3,6,8,11,12,13, ...)
I guess if you hit the MySQL max query (packet?) size there's a problem, but in terms of optimization, is there a better way to do it when the are a large number of IDs, perhaps by creating a temporary table, inserting the IDs and doing a join? If so, what is the other method and what is the cutoff point to switch to the other method?