<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="innodb-optimize-tablespace-page-allocation">
      </a>
      17.6.3.8 Optimizing Tablespace Space Allocation on Linux
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045165001664">
  </a>
  <p>
   You can optimize how
   <code class="literal">
    InnoDB
   </code>
   allocates space to
      file-per-table and general tablespaces on Linux. By default, when
      additional space is required,
   <code class="literal">
    InnoDB
   </code>
   allocates
      pages to the tablespace and physically writes NULLs to those
      pages. This behavior can affect performance if new pages are
      allocated frequently. You can disable
   <a class="link" href="innodb-parameters.html#sysvar_innodb_extend_and_initialize">
    <code class="literal">
     innodb_extend_and_initialize
    </code>
   </a>
   on
      Linux systems to avoid physically writing NULLs to newly allocated
      tablespace pages. When
   <a class="link" href="innodb-parameters.html#sysvar_innodb_extend_and_initialize">
    <code class="literal">
     innodb_extend_and_initialize
    </code>
   </a>
   is
      disabled, space is allocated to tablespace files using
   <code class="literal">
    posix_fallocate()
   </code>
   calls, which reserve space
      without physically writing NULLs.
  </p>
  <p>
   When pages are allocated using
   <code class="literal">
    posix_fallocate()
   </code>
   calls, the extension size is
      small by default and pages are often allocated only a few at a
      time, which can cause fragmentation and increase random I/O. To
      avoid this issue, increase the tablespace extension size when
      enabling
   <code class="literal">
    posix_fallocate()
   </code>
   calls. Tablespace
      extension size can be increased up to 4GB using the
   <code class="literal">
    AUTOEXTEND_SIZE
   </code>
   option. For more information,
      see
   <a class="xref" href="innodb-tablespace-autoextend-size.html" title="17.6.3.9 Tablespace AUTOEXTEND_SIZE Configuration">
    Section 17.6.3.9, “Tablespace AUTOEXTEND_SIZE Configuration”
   </a>
   .
  </p>
  <p>
   <code class="literal">
    InnoDB
   </code>
   writes a redo log record before
      allocating a new tablespace page. If a page allocation operation
      is interrupted, the operation is replayed from the redo log record
      during recovery. (A page allocation operation replayed from a redo
      log record physically writes NULLs to the newly allocated page.) A
      redo log record is written before allocating a page regardless of
      the
   <a class="link" href="innodb-parameters.html#sysvar_innodb_extend_and_initialize">
    <code class="literal">
     innodb_extend_and_initialize
    </code>
   </a>
   setting.
  </p>
  <p>
   On non-Linux systems and Windows,
   <code class="literal">
    InnoDB
   </code>
   allocates new pages to the tablespace and physically writes NULLs
      to those pages, which is the default behavior. Attempting to
      disable
   <a class="link" href="innodb-parameters.html#sysvar_innodb_extend_and_initialize">
    <code class="literal">
     innodb_extend_and_initialize
    </code>
   </a>
   on
      those systems returns the following error:
  </p>
  <p>
   <span class="errortext">
    Changing innodb_extend_and_initialize not supported on
      this platform. Falling back to the default.
   </span>
  </p>
 </div>
 <br/>
</div>
