Home Explore Blog CI



postgresql

7th chunk of `doc/src/sgml/ref/initdb.sgml`
94b7dbe75dfd62d8594903045bfc0f535dc65d47c837da580000000100000fb3
 Forcibly set the server parameter <replaceable>name</replaceable>
        to <replaceable>value</replaceable> during <command>initdb</command>,
        and also install that setting in the
        generated <filename>postgresql.conf</filename> file,
        so that it will apply during future server runs.
        This option can be given more than once to set several parameters.
        It is primarily useful when the environment is such that the server
        will not start at all using the default parameters.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-debug">
      <term><option>-d</option></term>
      <term><option>--debug</option></term>
      <listitem>
       <para>
        Print debugging output from the bootstrap backend and a few other
        messages of lesser interest for the general public.
        The bootstrap backend is the program <command>initdb</command>
        uses to create the catalog tables.  This option generates a tremendous
        amount of extremely boring output.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-discard-caches">
      <term><option>--discard-caches</option></term>
      <listitem>
       <para>
        Run the bootstrap backend with the
        <literal>debug_discard_caches=1</literal> option.
        This takes a very long time and is only of use for deep debugging.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-l">
      <term><option>-L <replaceable class="parameter">directory</replaceable></option></term>
      <listitem>
       <para>
        Specifies where <command>initdb</command> should find
        its input files to initialize the database cluster.  This is
        normally not necessary.  You will be told if you need to
        specify their location explicitly.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-no-clean">
      <term><option>-n</option></term>
      <term><option>--no-clean</option></term>
      <listitem>
       <para>
        By default, when <command>initdb</command>
        determines that an error prevented it from completely creating the database
        cluster, it removes any files it might have created before discovering
        that it cannot finish the job. This option inhibits tidying-up and is
        thus useful for debugging.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-no-sync">
      <term><option>-N</option></term>
      <term><option>--no-sync</option></term>
      <listitem>
       <para>
        By default, <command>initdb</command> will wait for all files to be
        written safely to disk.  This option causes <command>initdb</command>
        to return without waiting, which is faster, but means that a
        subsequent operating system crash can leave the data directory
        corrupt.  Generally, this option is useful for testing, but should not
        be used when creating a production installation.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-no-sync-data-files">
      <term><option>--no-sync-data-files</option></term>
      <listitem>
       <para>
        By default, <command>initdb</command> safely writes all database files
        to disk.  This option instructs <command>initdb</command> to skip
        synchronizing all files in the individual database directories, the
        database directories themselves, and the tablespace directories, i.e.,
        everything in the <filename>base</filename> subdirectory and any other
        tablespace directories.  Other files, such as those in
        <literal>pg_wal</literal> and <literal>pg_xact</literal>, will still be
        synchronized unless the <option>--no-sync</option> option is also
        specified.
       </para>
       <para>
        Note that if <option>--no-sync-data-files</option>

Title: initdb Options: Debugging, File Handling, and Synchronization
Summary
This section describes less commonly used `initdb` options. These include setting server parameters, enabling debugging output, discarding caches, specifying input file locations, preventing cleanup on error, and controlling file synchronization to disk. The `--no-sync-data-files` option allows skipping synchronization of database files for faster initialization, which is suitable for testing.