Docs / reference
SQL syntax extensions, system variables, and the sys.* routines for vectors, ML, and the agent.
A VECTOR(n) column stores a fixed-width array of
n float32 values. Values are written and read as
bracketed lists, e.g. [0.1, 0.2, 0.3].
TO_VECTOR(str) / STRING_TO_VECTOR(str) — parse a string into a vectorFROM_VECTOR(vec) / VECTOR_TO_STRING(vec) — render a vector to a stringVECTOR_DIM(vec) — the number of dimensionsDISTANCE(v1, v2, 'metric') — similarity metric; COSINE, DOT, or EUCLIDEANRapid is a secondary engine. A table is mirrored into the in-memory column store with two statements:
ALTER TABLE lineitem SECONDARY_ENGINE = RAPID; ALTER TABLE lineitem SECONDARY_LOAD;
From then on the optimizer routes each query by cost. The session variable
use_secondary_engine can force or disable the secondary
engine for the connection.
The sys.* routines below are thin wrappers over native
functions. You can call the native functions directly:
ML_MODEL_TRAIN, ML_MODEL_PREDICT_ROW, ML_MODEL_PREDICT_TABLEML_MODEL_SCORE, ML_MODEL_EXPLAIN, ML_MODEL_EXPLAIN_ROW, ML_MODEL_EXPLAIN_TABLEML_MODEL_EMBED_ROW, ML_MODEL_EMBED_TABLEML_MODEL_GENERATE, ML_MODEL_GENERATE_TABLEML_MODEL_LOAD, ML_MODEL_UNLOAD, ML_MODEL_IMPORT, ML_MODEL_LIST, ML_MODEL_ACTIVEuse_secondary_engine — OFF | ON | FORCED (default ON)secondary_engine_cost_threshold — cost ratio below which queries stay on the row storeshow_create_table_skip_secondary_engine — omit secondary-engine clauses from SHOW CREATE TABLErapid_memory_size_max — memory budget for the column storerapid_pop_buffer_size_max — per-thread populate buffer caprapid_parallel_load_max — parallel load threadsrapid_parallel_part_load_threshold — partition count before parallel loadrapid_propagation_mode — how committed changes reach the column storerapid_async_column_threshold — column size that triggers async loadrapid_use_dynamic_offload — enable dynamic query offloadingrapid_self_load_enabled — automatic load of candidate tablesrapid_self_load_interval_seconds — self-load scan intervalrapid_self_load_skip_quiet_check — bypass the quiet-period checkrapid_self_load_base_relation_fill_percentage — fill threshold for base relationsrapid_max_purger_timeout — max purge timeoutrapid_purge_batch_size — rows purged per batchrapid_min_versions_for_purge — minimum versions before purgerapid_purge_efficiency_threshold — efficiency target for purgingrapid_gc_interval_scn — garbage-collection intervalrapid_reload_on_restart — reload the column store on restartrapid_schema_embedding — use schema embeddings in the optimizer@chat_options — JSON configuration for sys.shannon_chat@shannon_agent_plugin — dispatcher level-1 plugin override (format schema.func)@_shannon_ml_handle — last ML model handle used by a procedure@_shannon_last_conv_id — last agent conversation id (auto-continue)Train, predict, score, and explain a model. All models live in your private catalog ML_SCHEMA_<user>.MODEL_CATALOG.
sys.ML_TRAIN('schema.table', 'target', options, @handle) — fit a model; task selects classification, regression, forecasting, anomaly_detection, log_anomaly_detection, recommendation, or topic_modelingsys.ML_PREDICT_ROW(JSON_OBJECT(...), @handle, options) — score one row, returns JSONsys.ML_PREDICT_TABLE('in.table', @handle, 'out.table', options) — score a whole table into a new tablesys.ML_SCORE('schema.table', 'target', @handle, 'metric', @score, options) — evaluate against ground truthsys.ML_EXPLAIN('schema.table', 'target', @handle, options) — feature importance for the modelsys.ML_EXPLAIN_ROW(input_data, @handle, options) — per-row explanation (function)sys.ML_EXPLAIN_TABLE('in.table', @handle, 'out.table', options) — per-row explanations for a whole tablesys.ML_EMBED_ROW(text, options) — encode text into a vector embedding (function)sys.ML_EMBED_TABLE('db.table.column', 'db.table.column', options) — batch-embed a columnsys.ML_GENERATE(text, options) — LLM text generation or summarization (function)sys.ML_GENERATE_TABLE('db.table.column', 'db.table.column', options) — batch generation in parallelsys.ML_RAG(query, @out, options) — retrieve from vector stores and generate a grounded answersys.ML_RAG_TABLE('db.table.column', 'db.table.column', options) — batch RAG over a columnsys.ML_RETRIEVE_SCHEMA_METADATA(query, @out, options) — rank the tables most relevant to a natural-language querysys.NL_SQL(query, @out, options) — convert a question into a validated SELECT, optionally execute itsys.ML_MODEL_LOAD(@handle, 'user') — load a trained model into memorysys.ML_MODEL_UNLOAD(@handle) — unload a model from memorysys.ML_MODEL_IMPORT(content, metadata, @handle) — import a model (e.g. ONNX)sys.ML_MODEL_EXPORT(@handle, 'schema.table') — export a model to a table for backup or sharingsys.ML_MODEL_ACTIVE('user', @out) — report which models are loaded in memorysys.shannon_chat(message) — the agent entry point (procedure); returns a response result setsys.shannon_agent_default(message, conversation_id) — the built-in dispatcher-level-4 agent (function)sys.shannon_agent_register_plugin(name, schema, func, priority, desc, @result) — register a plugin agentsys.shannon_agent_unregister_plugin(name, @result) — unregister a plugin agentsys.shannon_agent_toggle_plugin(name, enabled, @result) — enable or disable a plugin agentsys.shannon_agent_list_plugins() — list registered plugins with statusML_SCHEMA_<user>.MODEL_CATALOG — model metadata (owner, task, target, timestamps)ML_SCHEMA_<user>.MODEL_OBJECT_CATALOG — large model binaries, stored in 16 MB chunksmysql.shannon_api_configs — pre-configured LLM provider credentials (API keys stored encrypted), referenced by api_configmysql.agent_sql_trace — per-turn SQL execution audit logmysql.agent_review_plan / mysql.agent_review_history — approval plans and decisionsmysql.agent_memory — conversation memory with vector embeddingsmysql.agent_tx_lease — agent transaction leasesmysql.shannon_agent_plugins — the agent plugin registry