<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="update-optimization">
      </a>
      10.2.5.2 Optimizing UPDATE Statements
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045227629728">
  </a>
  <p>
   An update statement is optimized like a
   <a class="link" href="select.html" title="15.2.13 SELECT Statement">
    <code class="literal">
     SELECT
    </code>
   </a>
   query with the
          additional overhead of a write. The speed of the write depends
          on the amount of data being updated and the number of indexes
          that are updated. Indexes that are not changed do not get
          updated.
  </p>
  <p>
   Another way to get fast updates is to delay updates and then
          do many updates in a row later. Performing multiple updates
          together is much quicker than doing one at a time if you lock
          the table.
  </p>
  <p>
   For a
   <code class="literal">
    MyISAM
   </code>
   table that uses dynamic row
          format, updating a row to a longer total length may split the
          row. If you do this often, it is very important to use
   <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
    <code class="literal">
     OPTIMIZE TABLE
    </code>
   </a>
   occasionally.
          See
   <a class="xref" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
    Section 15.7.3.4, “OPTIMIZE TABLE Statement”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
