## 49.1. Logical Decoding Examples

 The following example demonstrates controlling logical decoding using the SQL interface.

 Before you can use logical decoding, you must set [wal\_level](runtime-config-wal.html#GUC-WAL-LEVEL) to `logical` and [max\_replication\_slots](runtime-config-replication.html#GUC-MAX-REPLICATION-SLOTS) to at least 1. Then, you should connect to the target database (in the example below, `postgres`) as a superuser.

```
postgres=# -- Create a slot named 'regression_slot' using the output plugin 'test_decoding'
postgres=# SELECT * FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding', false, true);
    slot_name    |    lsn
