On 1/28/2011 11:23 AM, David Harkness wrote: > On Fri, Jan 28, 2011 at 11:03 AM, Marc Guay <marc.guay@xxxxxxxxx> 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 > cron it. Setup a cron script that runs every 5 minutes. A seconds work every 5 minutes isn't too much is it? Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php