SQL Federation & Acceleration

Give agents and apps one SQL endpoint across databases, warehouses, data lakes, and APIs. Spice accelerates latency-sensitive data locally for sub-second queries.

Diagram of apps, AI agents, and dashboards querying Spice federation, with an accelerator, over a data store of Databricks, PostgreSQL, Snowflake, and Amazon S3

Federate and accelerate in a single runtime

Consolidate operational, analytical, and object store data into a governed and accelerated SQL layer.

Connect to disparate
data sources

Join and aggregate data from data lakes, operational databases, and warehouses in one query.

Explore federated SQL query

Deliver sub-second
query performance

Copy hot tables into Spice Cayenne, a local columnar accelerator, and add indexes. Queries read the local copy, not the source.

Explore data acceleration

Simplify your
data stack

Replace separate query engines, ETL jobs, and custom caches with one runtime.

Get started with Spice

Simplicity at scale

Once apps and agents have secure access to data, Spice delivers the primitives they need in one runtime: search, inference, real-time analytics, and governance. Everything runs on object storage, so it stays simple to operate from one deployment to hundreds.

Integrated AI and Search

Integrated AI and search workflows

Run hybrid search and LLM inference in the same runtime as your data. Search and call models from SQL, next to federated and accelerated tables.

Explore search features

Search and inference in one SQL query: an agent sends one SQL query. Hybrid search, vector and full-text, scans an accelerated orders table from PostgreSQL and finds the two orders about late refunds. Those rows move to a model, and ai() infers what happened to each order: a shipping delay, and a repeat delay with a refund due. The answer goes back to the agentSELECT id, ai('What happened? ' || note) AS causeFROM rrf(vector_search(orders, 'late refund'),text_search(orders, 'late refund'))orders#1042Box came a week late#1063Gift wrap please#1077Late again, refund pls#1090Great fit, thanksHybrid searchModelai()Shipping delayRepeat delay: refund#1042Box came a week late#1077Late again, refund plsAgent2 delays, refunds dueAn agent sends one SQL query.Hybrid search finds the orders that match.A model reads each row and infers what happened.Search and inference in one SQL query.
High-throughput CDC

Real-time analytics on operational data

Spice streams each change from PostgreSQL, MySQL, MongoDB, and Amazon DynamoDB into an analytics replica with high-throughput CDC. Large analytical queries run on the replica, not on your operational database.

Explore the analytics replica

Governance and observability

Governance, observability, and control

Monitor refresh status, query latency, and errors with built-in Prometheus metrics. Export metrics and logs to an OpenTelemetry collector. Spice.ai Enterprise adds Cedar policies for roles, row filters, and column masks.

Explore observability

Open-source tooling

Familiar open-source tooling

Spice is written in Rust and built on open source and open formats, including Apache DataFusion, Apache Arrow, Apache Iceberg, Delta Lake, and Vortex. Your data stays in formats you control, and your tools connect over Arrow Flight SQL, ADBC, or HTTP.

Read the client docs

Federate and accelerate in one file

Join Parquet in S3 with a PostgreSQL table in one federated query.

# spicepod.yamldatasets:  - from: s3://spiceai-demo-datasets/taxi_trips/2024/    name: taxi_trips    params: { file_format: parquet, s3_auth: public }  - from: postgres:taxi_zones    name: taxi_zones    params:      pg_host: localhost      pg_port: 15432      pg_db: taxi      pg_user: postgres      pg_pass: ${secrets:SPICE_PG_PASS}      pg_sslmode: disablesql> SELECT z.zone, COUNT(*) AS trips     FROM taxi_trips t                 -- S3     JOIN taxi_zones z                 -- PostgreSQL       ON t."PULocationID" = z.location_id     GROUP BY z.zone ORDER BY trips DESC LIMIT 3;JFK Airport                 145240Midtown Center              143471Upper East Side South       142708Time: 2.705 seconds
  1. Connect your sources

    In spicepod.yaml, add a dataset for each table. Each dataset names its source in from, such as PostgreSQL or Amazon S3.

  2. Accelerate the tables you read most

    Add an acceleration block with engine: cayenne to a dataset. Spice keeps a local copy in Spice Cayenne and refreshes it.

  3. Query everything in one SQL statement

    Start Spice with spice run. One query joins the local copy and the source, with no ETL pipeline.

  1. /plugin marketplace add spiceai/skills
  2. /plugin install spiceai@spiceai

Proven in production

Teams that build real-time systems run their data-intensive workloads on Spice.

Peter Janovsky

“Spice opened the door to take these critical control-plane datasets and move them next to our services in the runtime path.”

Peter Janovsky

Software Architect, Twilio

Darin Douglass

100x

Faster queries

“It just spins up and works, which is really nice. The responsiveness is amazing, which is a huge gain for the customer.”

Tim Ottersburg

“Partnering with Spice AI has transformed how NRC Health delivers AI-driven insights. By unifying siloed data across systems, we accelerated AI feature development, reducing time-to-market from months to weeks - and sometimes days. With predictable costs and faster innovation, Spice isn't just solving some of our data and AI challenges - it's helping us redefine personalized healthcare.”

Tim Ottersburg

VP of Technology, NRC Health

FAQs

Answers to common questions about SQL federation and acceleration in Spice.

SQL federation runs one SQL query across many data sources, as if they were one database. Spice connects to sources such as Amazon S3, PostgreSQL, Snowflake, and Databricks. It sends filters and other supported operations to each source, and then joins the results. You do not copy the data first. See query federation.

Acceleration copies a dataset into Spice Cayenne, a local columnar accelerator inside the Spice runtime. Queries on that dataset then read the local copy and do not wait on the source. Spice refreshes the copy on an interval or from a change data capture (CDC) stream. See data acceleration.

No. Federated queries read each source directly. For an accelerated dataset, Spice loads and refreshes the local copy itself, from the settings in spicepod.yaml. You do not build or run a separate pipeline.

Spice has about 40 data connectors. They include databases such as PostgreSQL, MySQL, SQL Server, and Oracle, warehouses such as Snowflake, Databricks, and ClickHouse, and object stores such as Amazon S3 and Azure Blob Storage. Table formats include Apache Iceberg and Delta Lake. See the integrations list.

Send SQL to the HTTP API at /v1/sql on port 8090, or use Arrow Flight SQL on port 50051. Spice also supports ADBC clients and SDKs for Python, Go, Rust, Java, .NET, and JavaScript. The open-source runtime supports JDBC and ODBC clients through the Flight SQL drivers. On Spice Cloud, JDBC and ODBC need an Enterprise plan.

Most query engines do analytics only. Teams then add separate systems for federation, caching, and serving. Spice does federation, acceleration, hybrid search, and LLM inference in one runtime. You can run it next to your application, so hot data stays close to the code that reads it.

Yes. The Spice runtime is open source under the Apache 2.0 license. Spice Cloud runs Spice as a managed service. Spice.ai Enterprise adds Cedar policies and enterprise support.

Spice is one runtime that does two jobs. Federation runs one SQL query across many data sources. Acceleration copies the tables that you query most into a local engine, so those queries do not wait on the source. You declare both in a spicepod.yaml file:

  1. Connect: each dataset names a source in from, such as postgres:public.customers or s3://example-bucket/orders/. Spice adds the dataset to its SQL catalog.
  2. Federate: Spice plans each query with Apache DataFusion. It sends filters and other supported operations to each source, and then joins the results.
  3. Accelerate: set acceleration.enabled: true on a dataset. Spice loads the dataset into an accelerator engine and answers queries from that local copy.
  4. Refresh: Spice reloads the local copy on each refresh_check_interval, or applies a stream of changes when refresh_mode is changes.

The following Spicepod federates a PostgreSQL table and accelerates a Parquet dataset from Amazon S3 in Spice Cayenne:

version: v1
kind: Spicepod
name: orders-analytics

datasets:
  - from: postgres:public.customers
    name: customers
    params:
      pg_host: ${secrets:PG_HOST}
      pg_db: app
      pg_user: ${secrets:PG_USER}
      pg_pass: ${secrets:PG_PASS}

  - from: s3://example-bucket/orders/
    name: orders
    params:
      file_format: parquet
    acceleration:
      enabled: true
      engine: cayenne
      mode: file
      refresh_check_interval: 10m

Start the runtime with spice run. Then send SQL to the HTTP API on port 8090:

curl http://localhost:8090/v1/sql \
  -H 'Content-Type: text/plain' \
  -d 'SELECT c.name, SUM(o.total) AS revenue
      FROM orders o JOIN customers c ON o.customer_id = c.id
      GROUP BY c.name ORDER BY revenue DESC LIMIT 10'

Spice reads orders from the local Cayenne files. It sends the customers part of the query to PostgreSQL. To get started, read the federation docs and the acceleration docs.

QuestionFederationAcceleration
Where does it run?Each source runs the operations it supports. Spice does the rest, including joinsIn a local engine inside the Spice runtime
How fresh is the data?Current at query time, or a cached resultCurrent as of the last refresh, or a cached result
What sets the speed?The source and the networkThe local engine. By default, there is no call to the source
What do I configure?from and the connector paramsAn acceleration block on the dataset
When do I use it?Large tables, or tables that you query rarelyHot tables that apps, dashboards, and agents query often

You can use both in one query, as in the example above. The SQL results cache is on by default for both. A repeated query can return a recent cached result, not a new read of the source or the local copy. Configure it with runtime.caching.sql_results.

Use Spice Cayenne. Since Spice v2.4, Cayenne is the default engine on Linux and macOS, and every other engine is deprecated. On Windows, the default is Arrow. Set acceleration.mode: file to keep the data on disk, because the default mode is memory:

acceleration:
  enabled: true
  engine: cayenne
  mode: file

In file mode, Cayenne keeps each dataset in columnar files on local disk. It handles datasets of 10 GB or larger. Add indexes and a primary_key to an accelerated dataset to speed up lookups. To use Cayenne on Windows, run Spice in Docker or WSL. Read the Spice Cayenne docs.

The refresh_mode setting controls how Spice updates the local copy:

  • full: Spice reloads the full dataset on each refresh. This is the default for most connectors.
  • append: Spice adds only new rows. For a streaming source such as Kafka, Spice appends each new message. For other sources, set a time_column so that Spice can find the new rows.
  • changes: Spice applies a change data capture (CDC) stream, such as PostgreSQL logical replication, DynamoDB Streams, or Debezium on Kafka. This is the default for debezium and cdc datasets. Set it on PostgreSQL, MySQL, MongoDB, and DynamoDB datasets.
  • caching: Spice stores the results of HTTP-based datasets and uses the request metadata as the cache key. On a cache miss, Spice sends the request to the source.
  • snapshot: Spice loads a read-only copy from the snapshot store only, and does not read the source. Enable snapshots to use it.

Read data refresh for each mode's settings.

With the default settings, queries on an accelerated dataset read only the local copy. Three settings let some queries go to the source:

  • ready_state: on_registration or on_schema_resolved makes the dataset ready before the first load completes. Until then, queries read an acceleration from a previous run if one exists. Otherwise they go to the source. The default, on_load, waits for the load.
  • on_zero_results: use_source sends the query to the source when the local copy returns no rows. The default is return_empty.
  • refresh_mode: caching sends the request to the source on a cache miss.

Keep the defaults when queries must read only the local copy.

See Spice in action

Walk through your use case with an engineer and see how Spice handles federation, acceleration, and AI integration for production workloads.

Talk to an engineer (opens in a new tab)