TheRobotLearns Platform · ProxySQL: from first install to production
DuckDB Plugin Operation and Troubleshooting
Learning objectives
- Diagnose DuckDB plugin-load failures from path/permission, library, or ABI/release/verification errors.
- Recover DuckDB engine-open failures from path/permission, read-only, in-memory, and engine-setting mismatches.
- Resolve DuckDB listener startup by checking addresses, ports, empty values, and required save-and-restart.
- Troubleshoot DuckDB auth resets via `mysql_users`/`pgsql_users`, runtime load, connection settings, and logs.
- Handle DuckDB protocol issues: prepared statements, multi-statements, text columns, and NULL `RETURNING` values.
- Correct DuckDB config drift by comparing editable/runtime variables, loading or restarting, saving, and avoiding Main-overwrite.
- Investigate denied DuckDB external access and resource pressure via permissions, sandbox, limits, and restart recovery.
Why DuckDB plugin stops at startup
You start ProxySQL, but the DuckDB listeners are absent and the plugin did not load. Confirm the plugins entry uses the installed absolute path. Confirm the ProxySQL service account can read the .so and traverse its parent directories. Check the loader error for a missing shared-library dependency.
If the core and plugin have an ABI or DEBUG mismatch, install a core and plugin built together with the same tier and build mode. A DEBUG core requires a DEBUG plugin, and release requires release. If you change build modes, clean stale objects and use PROXYSQL40=1 on every rebuild.
If a DuckDB source archive fails verification during build, run bash deps/duckdb/verify-source.bash from the ProxySQL source root. Inspect the checksum or corrupt-archive diagnostic, then restore the vendored archive from the matching source checkout before rebuilding.
Check duckdb-database_path, parent-directory existence, ownership, service sandbox rules, and permissions for the ProxySQL operating-system account. A writable database needs write access to its containing directory and the database file. Use an absolute path to avoid opening a different file when the service's working directory changes.
duckdb-read_only=true cannot use :memory: or an empty database path. Configure an existing file-backed database or disable read-only mode, save the corrected configuration, and restart ProxySQL. If the startup log names a setting in a duckdb_set_config or database-open error, correct that saved value before restarting again. For a running plugin, LOAD validates duckdb-memory_limit before applying live changes.
Takeaway: Plugin-load checks cover path, dependencies, and matching builds; engine-open checks cover path, permissions, read-only mode, and invalid engine settings.
Listener ports and frontend users
You point a client at the DuckDB MySQL port, but the listener does not start. Check whether the configured address exists locally and whether another process or ProxySQL listener already uses the port. Use a dedicated port for each listener.
Common defaults are 6031 for the DuckDB MySQL protocol, 6032 for ProxySQL Admin, 6033 for the normal ProxySQL MySQL listener, and 6034 for the DuckDB PostgreSQL protocol. An empty listener value disables that protocol. After changing duckdb-mysql_ifaces or duckdb-pgsql_ifaces, save to Disk, which persists settings, and restart ProxySQL, because LOAD does not rebind sockets.
Use a frontend credential in the correct table. Use mysql_users for the MySQL endpoint and pgsql_users for the PostgreSQL endpoint. Confirm the user is active, enabled for frontend use, and loaded to Runtime, which is what is in effect. Run LOAD MYSQL USERS TO RUNTIME after editing mysql_users, or LOAD PGSQL USERS TO RUNTIME after editing pgsql_users. Save users to Disk if they must survive restart. A user needs a corresponding entry in each table to authenticate through both protocols.
Check duckdb-max_connections and application connection-pool sizes. At the cap, the plugin closes new sockets before protocol setup, so clients may show EOF or a reset instead of a descriptive error. Lowering the cap preserves existing connections. If connections stall during authentication, check the ProxySQL log for a Closing not established DuckDB client connection warning. Review mysql-connect_timeout_client or pgsql-connect_timeout_client for that endpoint, and check for startup or shutdown activity.
Takeaway: Listener startup needs ports, save, and restart; authentication needs the right user table, runtime load, disk persistence, and timeout or connection-limit checks.
Protocol quirks in DuckDB queries
A statement works in MySQL but fails on a DuckDB endpoint. The endpoint protocol does not select the SQL dialect, so write DuckDB SQL. Only a small set of discovery and session commands is handled for compatibility. Start with SELECT 42;, then reduce the failing statement to find unsupported syntax, missing objects, permissions, or driver protocol mode.
The listeners do not support client-visible prepared statements. MySQL clients receive Command not supported with error 1045 and SQLSTATE 28000 when preparing, even after authentication. PostgreSQL extended-query requests return SQLSTATE 0A000. Configure simple-query mode or use a non-prepared text-query API. Check that the driver's parameter API can safely encode values, and do not concatenate untrusted input into SQL. If the driver requires server-side prepared statements, choose another compatible client or access method.
Send one statement per request. Sending SET NAMES utf8; SELECT 1 as one request is rejected, but you send those statements separately. Both protocols advertise text columns. Parse results according to the expected schema instead of MySQL or PostgreSQL type metadata. Some result types, such as UUIDs and nested values, need conversion to text. Certain DML statements with RETURNING may return NULL for an unsupported type even when the stored value is not NULL. Cast the affected expression explicitly.
Takeaway: Write DuckDB SQL, avoid prepared and multi-statement requests, parse text columns, and cast unsupported RETURNING values.
Config drift and restart recovery
You edited a duckdb-* value, but the plugin still behaves as before. Compare editable and running values with two SELECT statements against global_variables and runtime_global_variables. The editable settings are in Main, and Runtime is what is in effect. For a live change, run LOAD DUCKDB VARIABLES TO RUNTIME and inspect any error. An invalid value or pending restart change in Main causes the request to fail. Correct those values before retrying.
For listener addresses, database path, read-only mode, or enabling external access, save Main with SAVE DUCKDB VARIABLES TO DISK and restart ProxySQL.
LOAD applies changes without saving them. After reviewing Main, run SAVE DUCKDB VARIABLES TO DISK. Saving Runtime to Memory first will replace Main and discard pending edits, so use that command only if the running settings are the ones you intend to keep.
External file access is disabled by default. To enable it deliberately, edit duckdb-enable_external_access in Main, save to Disk, and restart ProxySQL. LOAD cannot enable it while the database is open. Verify filesystem permissions and sandbox restrictions.
The plugin has no per-query execution timeout. Bound application concurrency, review duckdb-memory_limit, choose a conservative duckdb-threads value, and reduce duckdb-max_connections as needed; all three settings apply live. The memory limit is not a total process cap. If a running query must stop and the client cannot cancel it, a controlled ProxySQL restart may be necessary. A restart loses in-memory DuckDB data and interrupts active work.
Takeaway: Compare Main and runtime, LOAD live edits, SAVE restart-required settings, enable external access through Main, and treat restarts as resource recovery.
Diagnose and persist a DuckDB setting
SELECT variable_name, variable_value FROM global_variables WHERE variable_name LIKE 'duckdb-%' ORDER BY variable_name;
SELECT variable_name, variable_value FROM runtime_global_variables WHERE variable_name LIKE 'duckdb-%' ORDER BY variable_name;
LOAD DUCKDB VARIABLES TO RUNTIME;
SAVE DUCKDB VARIABLES TO DISK;
SELECT variable_name, variable_value FROM disk.global_variables WHERE variable_name LIKE 'duckdb-%' ORDER BY variable_name;The first query lists the editable duckdb-* values in global_variables. The second query lists the running duckdb-* values in runtime_global_variables. The LOAD command applies Main to Runtime and reports any invalid or pending-restart error. The SAVE command persists the Main values to Disk. The final query reads the saved duckdb-* rows from disk.global_variables.
Try it: config_layer_sim
You change duckdb-memory_limit in Main, but a client still behaves as if the old value applies. Run these queries in ProxySQL Admin:
SELECT variable_name, variable_value FROM global_variables WHERE variable_name LIKE 'duckdb-%' ORDER BY variable_name;
SELECT variable_name, variable_value FROM runtime_global_variables WHERE variable_name LIKE 'duckdb-%' ORDER BY variable_name;Compare duckdb-memory_limit in both result sets. If the values differ, run LOAD DUCKDB VARIABLES TO RUNTIME. If the command fails, inspect duckdb-memory_limit and any invalid or pending-restart values in Main, correct them, and retry. If the changed setting is a listener address, database path, read-only mode, or external access, run SAVE DUCKDB VARIABLES TO DISK and restart ProxySQL.
Sources
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
- Troubleshoot the DuckDB plugin
Do more with an account
- Graded quizzes is available on your account.
- Saving your progress is available on your account.
- Hands-on labs is available on your account.
- AI tutoring is available on your account.