# yc-360 Script Execution Modes for Databases
The yc-360 script can also capture troubleshooting data directly from your database server, such as sessions and locks, deadlocks, timeouts, slow queries, table and index health, connections, checkpoints and database errors, and transmit it to the yCrash server for analysis. It connects with a read-only monitoring user and never changes data or settings.
Database capture currently supports PostgreSQL (versions 14 to 19). MySQL and Oracle are coming soon.
The yc-360 script supports multiple execution modes for databases. Choose the mode that best fits your needs to learn how to configure and execute the script.
# Prerequisites
Complete these one-time steps on the PostgreSQL server before the first capture. These steps require a database superuser (for example postgres).
1. Enable the database log and query statistics. Some data, such as deadlock details, timeouts, errors and checkpoint times, exists only in the PostgreSQL log, and slow-query data needs the pg_stat_statements extension. Run:
ALTER SYSTEM SET logging_collector = on;
ALTER SYSTEM SET log_checkpoints = on;
ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements';
2
3
Check the existing libraries:
SHOW shared_preload_libraries;
If no libraries are configured, run:
ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements';
If other libraries are already configured, retain them and append pg_stat_statements if it is not already present.
For example, if timescaledb is already configured:
ALTER SYSTEM SET shared_preload_libraries = 'timescaledb,pg_stat_statements';
2. (Optional) Enable query plans. To see the execution plan of slow queries in the Query Detail panel (Inspect → Plan tab), let PostgreSQL log the plans of slow queries using the auto_explain module.
If query plan capture is required, include auto_explain along with pg_stat_statements and all existing libraries when setting shared_preload_libraries in Step-1.
ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements,auto_explain';
Then run:
ALTER SYSTEM SET auto_explain.log_min_duration = '200ms';
ALTER SYSTEM SET compute_query_id = on;
ALTER SYSTEM SET log_line_prefix = '%m [%p] %Q ';
2
3
Note: auto_explain.log_min_duration logs execution plans for queries that take 200 milliseconds or longer. The compute_query_id setting and %Q in the log prefix allow the yc-360 script to associate logged execution plans with their corresponding queries. Always retain existing libraries and their loading order in shared_preload_libraries. If TimescaleDB is configured, keep timescaledb first. Specify all libraries as a single comma-separated string.
3. Restart PostgreSQL
Restart the PostgreSQL server to apply all the configuration changes. logging_collector and shared_preload_libraries only take effect after a restart.