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

Re: MySQL Question



> > Howdy there.  Well, there is a locking function in mysql, but in practice, 
> > it's rarely required.  MySQL guarantees that any one SQL statement is atomic.
> > That's enough 99 percent of the time, especially for straightforward
> > applications.
> 
> So does that mean approx. once every 100 entries submitted we corrupt our
> database?  I guess I don't understand what "atomic" means.
No, I mean that you don't HAVE to have locking in 99 percent of applications
you write.  (I've only had to do locking in one of the MySQL apps I've
ever written.)  There won't be any database corruption in MySQL,
unless someone runs kill -9 on the database engine, or the host system
loses power.  (Even in that event, there may not be any, and if there is,
isamchk in MySQL does a great job of cleaning up the mess.)

It's a question of algorithm development.  Build an algorithm that doesn't
require database locking.  In my experience, that's usually a more elegant
design that requiring lots of locks in any case.

Cheers.
-Dana
-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,
Dana M. Diederich        Phone: 1.501.855.7175
SMTP: dana@realms.org    HTTP:  http://realms.org/   ICQ: 16433785
Snail Mail: 19 Leicester Drive, Bella Vista, Ar 72714, USA
`Berkeley invented LSD and Unix, and I don't think that's a coincidence.'