# 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 to logical
and 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