Welcome Guest, Not a member yet? Register   Sign In
Active Record: COUNT WHERE?
#4

[eluser]Michael Wales[/eluser]
I think the performance hit between any of the options would be minimal at best.

I believe, from best performer to worst, would be:
1. Perform a COUNT() query on the database.
2. Perform a SELECT query and use the num_rows() function to return the query metadata.
3. Perform a SELECT query, then iterate those results, to perform counting with a variable.

A general rule of thumb - perform as many operations on the MySQL server as possible - it's designed to work with data in this manner and can do so very quickly.


Messages In This Thread
Active Record: COUNT WHERE? - by El Forum - 09-04-2007, 10:36 PM
Active Record: COUNT WHERE? - by El Forum - 09-05-2007, 12:00 AM
Active Record: COUNT WHERE? - by El Forum - 09-05-2007, 12:50 AM
Active Record: COUNT WHERE? - by El Forum - 09-05-2007, 06:43 AM
Active Record: COUNT WHERE? - by El Forum - 09-20-2007, 03:37 PM
Active Record: COUNT WHERE? - by El Forum - 09-20-2007, 03:51 PM
Active Record: COUNT WHERE? - by El Forum - 09-21-2007, 08:51 AM
Active Record: COUNT WHERE? - by El Forum - 09-21-2007, 05:07 PM
Active Record: COUNT WHERE? - by El Forum - 11-05-2007, 08:00 PM
Active Record: COUNT WHERE? - by El Forum - 12-18-2007, 08:50 AM
Active Record: COUNT WHERE? - by El Forum - 12-30-2008, 10:57 PM
Active Record: COUNT WHERE? - by El Forum - 05-21-2010, 11:47 PM
Active Record: COUNT WHERE? - by El Forum - 01-18-2012, 11:07 PM
Active Record: COUNT WHERE? - by El Forum - 03-03-2013, 09:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB