Re: Counting Online users, but not using a Session Table in MySQL

From: Date: Fri, 28 Jan 2011 19:23:26 +0000
Subject: Re: Counting Online users, but not using a Session Table in MySQL
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-311077@lists.php.net to get a copy of this message
On Fri, Jan 28, 2011 at 11:03 AM, Marc Guay <marc.guay@gmail.com> wrote: > 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. If this is like most web sites, users don't usually log out--they just stop requesting pages. With no logout event to decrement the count you need some other way to stop counting a particular user such as 30 minutes after they logged in. This is easily handled in a query on the users table, but it causes performance issues. David

« previous php.general (#311077) next »