Setting auto commit to one means that every modification is a separate transaction. Which means that if you have a relation between two tables, and you need to make an update/insert/delete in both tables, and you have auto commit on, you will be living dangerously, as your relations aren't modified atomically.

Newer versions of MySQL support transactions, but only if you use a specific kind of table. For a long time, the MySQL documentation said you had to code transaction support in your user code yourself.

Note that locking tables itself doesn't give you full transaction support - it just prevents someone else from modifying the table as well. You won't get rollbacks, and if you have to modify more than one table, you might get deadlocked, as someone else may lock the tables in the reverse order. Not to mention the potential performance hit if for every insert you need to lock the entire table.

Abigail


In reply to Re: OT: help with MySQL questions by Abigail-II
in thread OT: help with MySQL questions by kiat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.