DDL replication options
=======================

The :ref:`bdr.ddl_replication <bdr.ddl_replication>`  parameter specifies replication behavior.

``bdr.ddl_replication = all`` is the default and replicates DDL to the
default replication set, which by default means all nodes. Nondefault
replication sets don’t replicate DDL unless they have a :ref:`DDL filter <Replication sets>` 

defined for them.

You can also replicate DDL to specific replication sets using the
function :ref:`bdr.replicate_ddl_command() <System functions>`  . This can be helpful if you want to run DDL
commands when a node is down or if you want to have indexes or
partitions that exist on a subset of nodes or rep sets, for example, all
nodes at site1.

::

   SELECT bdr.replicate_ddl_command(
                   CREATE INDEX CONCURRENTLY ON foo (col7);,
                   ARRAY[site1],     -- the replication sets
                   all);              -- ddl_locking to apply

While we don’t recommend it, you can skip automatic DDL replication and
execute it manually on each node using the :ref:`bdr.ddl_replication <bdr.ddl_replication>`  configuration
parameter.

::

   SET bdr.ddl_replication = off;

When set, it makes PGD skip both the global locking and the replication
of executed DDL commands. You must then run the DDL manually on all
nodes.

..  Warning::
   Executing DDL manually on each node without global locking can cause the whole PGD group to stop replicating if conflicting DDL or DML executes concurrently.

The ``bdr.ddl_replication`` parameter can be set only by the
bdr_superuser, by superuser, or in the ``postgres.conf`` configuration
file.
