Re: Re: (another, not entirely)sessions question

From: Date: Fri, 20 Jul 2001 17:49:23 +0000
Subject: Re: Re: (another, not entirely)sessions question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-58949@lists.php.net to get a copy of this message
Hi Don! On Fri, 20 Jul 2001, Don Read wrote: > > On 20-Jul-2001 Er Galv?o Abbott wrote: > > Just a sugestion here, that may sound strange, but I'd do it like > > this: > > > > Why don't you keep a simle text-counter file for each user? Why this > > HAVE to go trough SQL? > > > > Just creat a text file with "0" on it. When the user posts, retrieve > > the number from the file, increment it and then write it back... > > > > This way you don't overload SQL and keep the post counter running... > > > > Because the database is optimized for this kind of stuff ? > > Once you get the db handle (and you have. you've authenticated right ?), > "SELECT count(*) from msgposts where user_id=$foo" is likely be faster & less > load then an open/read/close. > > > Trying to avoid hitting the database is a good maxim, but it's not the goal. > Note that a DB is ultimately doing the same thing, open and read a file, while on the other hand you can have some fast support for sessions, like shared memory which can be faster. -- teodor

« previous php.general (#58949) next »