Welcome Guest, Not a member yet? Register   Sign In
Is there a better way to count query results?
#2

[eluser]Joshua Logsdon[/eluser]
Avoiding the count altogether, you could also search for one matching record... so something like:
SELECT 1 WHERE container = 'myc1' AND margin = 'mym1' LIMIT 1
and if a row was returned an entry exists

To get detailed though I'm not a guru, if it's a MyISAM table then COUNT(*) will be already stored, which is good, BUT I doubt 'container' and 'margin' are indexes so that takes you back down to average. If it's a small table then really any changes you do for efficiency may be negligible.

I guess my point for thought is if you don't need to know how many exist, you can just find if one exists.


Messages In This Thread
Is there a better way to count query results? - by El Forum - 01-23-2010, 10:09 PM
Is there a better way to count query results? - by El Forum - 01-23-2010, 11:27 PM
Is there a better way to count query results? - by El Forum - 01-24-2010, 12:52 AM
Is there a better way to count query results? - by El Forum - 01-24-2010, 01:20 AM
Is there a better way to count query results? - by El Forum - 01-24-2010, 01:22 AM
Is there a better way to count query results? - by El Forum - 01-24-2010, 07:16 AM
Is there a better way to count query results? - by El Forum - 01-24-2010, 03:29 PM
Is there a better way to count query results? - by El Forum - 01-25-2010, 01:23 AM
Is there a better way to count query results? - by El Forum - 01-25-2010, 01:30 AM
Is there a better way to count query results? - by El Forum - 01-25-2010, 01:48 AM
Is there a better way to count query results? - by El Forum - 01-25-2010, 04:48 AM
Is there a better way to count query results? - by El Forum - 01-25-2010, 07:52 AM
Is there a better way to count query results? - by El Forum - 01-25-2010, 11:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB