Re: Counting Online users, but not using a Session Table in MySQL
| From: | Marc Guay | Date: | Fri, 28 Jan 2011 19:03:55 +0000 |
| Subject: | Re: Counting Online users, but not using a Session Table in MySQL | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311076@lists.php.net to get a copy of this message | ||
> I'm looking for a faster way to count online users. COUNT(*) is time consuming under
> MySQL.
If COUNTing is the heavy part, why not create a 'users_logged_in'
field somewhere and increment it when someone logs in and decrement it
when someone logs out? Then your query is just a straight SELECT.
Just chucking a thought out there.
Marc