[nycphp-talk] Re: semaphores on Windows
Analysis & Solutions
danielc at analysisandsolutions.com
Fri Mar 14 20:22:36 EST 2003
On Tue, Mar 11, 2003 at 12:33:01PM -0500, Ophir Prusak wrote:
> Dan - using the algorithm below, why is there a need to lock the table ?
> It'll work fine without table locking.
> 1. on selects, get the latest 10 from the database on selects (just in case)
> 2. and after an insert, find the 10th latest entry
> 3. delete all entries older then what u found in step 2
Admittedly, I was moving too fast and gave a flip answer. Seemed like
Emmanuel was unfamilliar with locking, so threw that lead to him.
Also, from the way your suggestion was written, I initially thought you
were going to do the deletes based on the initail select in step 1. I now
believe that's not what you really meant.
Finally, after step 2, there are more than ten records in the table.
Emmanuel hasn't completely elaborated exactly what's going on here, so I
don't know how sentsitive the whole thing is. Of course, this likely
wouldn't be a problem if using your excellent suggestion of getting only
the last ten records when doing selects, presumably via the LIMIT clause,
PHP classes that make web design easier
SqlSolution.info | LayoutSolution.info | FormSolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
More information about the talk