Re: Back from the dead with a racing question!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2009-07-17 at 13:36 -0700, ray@xxxxxxxxxxxxxx wrote:
> I strongly believe you have nothing to worry about and I think you are 
> over-thinking an issue that will never happen to you.
> Even if you have 2000 users, you will have nothing to worry about.
> 
> I manage db's on large scales and have run into every problem I never 
> imaginged and always figured out how to fix it.
> Throughout the years I have heard this particular issue come up among 
> novices and the heard vaugue suggestions given from people with little 
> experience.
> 
> There is no way you are going to run across a "race condition" because 
> queries that are waiting to be processes have the status of "wait" while a 
> table is locked.
> Its basically put into a queue.
> You can use INSERT DELAYED to better manage this if you are using MYISAM if 
> you experience a much higher volume of inserts.
> 
> For apps that have a very high INSERT frequency, I suggest using INNODB so 
> you won't experience table locking.
> 
> For your case, you have only 10 users and that is absolutely nothing to 
> worry about.
> 
> If you are concerned about multiple users accessing a row of data at the 
> same time, you will need to use INNODB and implement transactional queries.
> 
> This assumes you are using mysql of course. If you are using mssql, then I 
> cannot provide a good answer because I do not use that db.
> 
> -Ray Solomon
> 
> 
> 
> ----- Original Message ----- 
> From: "Jason Pruim" <jason@xxxxxxxxxxxxxx>
> To: "PHP-General List" <php-general@xxxxxxxxxxxxx>
> Sent: Friday, July 17, 2009 8:12 AM
> Subject:  Back from the dead with a racing question!
> 
> 
> > Hi everyone!
> >
> > So some of you may have noticed that I have been away for quite  awhile... 
> > Been trying to get settled (Moved across the country) and  getting a job.
> >
> > And now that that is done I have a question about a project that I  might 
> > be doing for my current employer and want to do it properly.
> >
> > If all goes through, I'll be writing an online database that upwards  of 
> > 10 people will be using at various times through out the day.  Basically, 
> > in a form they fill out a model number, customer name,  phone number etc. 
> > etc.. And then submit the form. After submitting  they need to write the 
> > log number on some paperwork. If I have 2  people submit the form at the 
> > same time, I'm thinking I could end up  with a race condition and they 
> > might get the wrong log number (The log  number is simply a consecutive 
> > record number)
> >
> > Do I need to be reading up on locking tables/rows? Or in my situation  as 
> > I've briefly described it do I not have to worry about it? Or is  there a 
> > third door with the magic bullet that will solve all my  problems? :)
> >
> > Any advice is greatly appreciated as always, RTFMing is good as well,  as 
> > long as M is defined :)
> >
> > I'm not afraid of google either, just need the right terms to hit it  with 
> > so I don't go into "search overload" as the commercials for a  rival 
> > search engine claim :)
> >
> > Thanks Everyone!
> >
> >
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> 
It's only really a problem where you use further code to edit details or
use details on that row and try to call it with MAX(id) instead of the
last insert id. I've seen this so much, and the people who do it like
this don't seem to understand what the problem is!

Thanks
Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux