LOAD PLUGIN

Enterprise

Plugins are developed against the open-source questdb library and run only on QuestDB Enterprise.

Learn more

Loads a plugin JAR from the plugin directory, making its SQL functions available immediately. Requires PLUGIN ADMIN permission.

Syntax

LOAD PLUGIN [IF NOT LOADED] plugin_name;
  • plugin_name — the JAR filename, with or without the .jar extension. May be quoted or unquoted.
  • IF NOT LOADED — optional clause that makes the command idempotent: no error is raised if the plugin is already loaded.

Description

LOAD PLUGIN performs the following steps:

  1. Looks up plugin_name in the set of discovered plugins (populated by SCAN PLUGINS or at startup).
  2. Checks that all declared plugin dependencies are already loaded.
  3. Creates an isolated URLClassLoader for the plugin JAR.
  4. Scans the JAR for FunctionFactory implementations and registers them under the plugin namespace.
  5. Invokes the PluginLifecycle.onLoad() callback if the plugin declares one.
  6. If any step fails, the load is fully rolled back and the plugin remains unloaded.

After a successful load, the compiled query cache is flushed and plugin functions are immediately available using qualified names: plugin_name.function_name(args). Quote the plugin name in SQL when it contains hyphens or dots (e.g. "my-plugin-1.0.0".my_func()).

Examples

Load a plugin
LOAD PLUGIN 'questdb-plugin-example-1.0.0';
Idempotent load
LOAD PLUGIN IF NOT LOADED 'questdb-plugin-example-1.0.0';

Error conditions

ErrorCause
Plugin not foundThe plugin name was not discovered by SCAN PLUGINS. Run SCAN PLUGINS first.
Plugin already loadedThe plugin is already loaded and IF NOT LOADED was not specified.
Plugin X requires plugin Y to be loaded firstA declared dependency is not loaded. Load the dependency first.

See also