You are here: Re: Is this a good idea? « PHP Programming Language « IT news, forums, messages
Re: Is this a good idea?

Posted by Jim Michaels on 01/25/06 23:51

I found this in the MySQL manual under row-level locking:
If you want to perform many INSERT and SELECT operations on a table when
concurrent inserts are not possible, you can insert rows in a temporary
table and update the real table with the records from the temporary table
once in a while. This can be done with the following code:

mysql> LOCK TABLES real_table WRITE, insert_table WRITE;
mysql> INSERT INTO real_table SELECT * FROM insert_table;
mysql> TRUNCATE TABLE insert_table;
mysql> UNLOCK TABLES;
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:YoOdneoZy5PKdEneRVn-sA@comcast.com...
> Geoff Berrow wrote:
>> Message-ID: <cuednQYv09gBwkneRVn-iA@comcast.com> from Jerry Stuckle
>> contained the following:
>>
>>
>>>So the system recomputes the balance. If there are sufficient funds in
>>>the account, it processes the withdrawal.
>>
>>
>> Isn't a lock required for the very short period of time in between
>> recomputing the balance and processing the withdrawal?
>>
>
> Yes, but that's a very short time - on a mainframe you're talking
> microseconds; milliseconds at the worst.
>
> You can never eliminate all locks. The secret is to minimize the number
> and length of the locks.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация