Count many rows

If I were to count let's say, maybe millions of rows how would you do it?

Let's say i have 10 million rows and 1 million of them is the country "Germany"

And i would run a query "Count(*) as count group by country = Germany"

Would that be bad or can the server handle it?


edited Sep '15

From the documentation you can use count as a prefix in a model query:


// How many employees are in the Testing area?
$rowcount = Employees::count(
    "area = 'Testing'"

You would just need to modify for your model. Model::count("country = 'Germany'");

But my question was, can my server handle that request if there is a million rows with country "Germany" ?

It can, but you can better add an index to speed up the query:

Thank you! :-)