Query a Lightning Table in Confluent Cloud

Lightning Table queries read your topic data with sub-second response times. You can run them in the Confluent Cloud Console, with the Confluent CLI, through an HTTP API, with a Model Context Protocol (MCP) client, or with a Java Database Connectivity (JDBC) client.

How Lightning Table queries work

A Lightning Table query reads data from the Lightning Table for an Apache Kafka® topic. Confluent Cloud updates the Lightning Table within 100 milliseconds of new data arriving in the topic. The Lightning Table persists independently of the topic’s retention policy. As a result, a Lightning Table query can return data that has already aged out of the topic.

A Lightning Table query runs once and returns a result. In that respect, it works like a snapshot query in Apache Flink®. But a Lightning Table query targets a different performance profile: sub-second response times and high concurrency for point lookups, range scans, and full scans. A snapshot query is better suited to complex, exploratory analysis over historical data.

The following table compares a Lightning Table query with Flink snapshot and streaming queries.

Query type

How it runs

Use it for

Lightning Table query

Runs once and returns a result in less than a second.

Point lookups, range scans, and full scans from many concurrent clients, such as applications and AI agents.

Snapshot query

Runs once, returns results, and exits.

Complex, exploratory analysis over historical data.

Streaming query

Runs continuously and returns results incrementally as new data arrives.

Processing data continuously as it arrives.

A Lightning Table query reads the Lightning Table instead of the topic. As a result, it might return different results than a Flink streaming or snapshot query on the same topic.

For more information about Flink queries, see Batch and Stream Processing in Confluent Cloud for Apache Flink.

Choose a query interface

Every query interface reads the same Lightning Tables. Each one suits a different kind of client:

Cloud Console

Explore a Lightning Table interactively in the query pane on the Lightning Tables page. You can’t run queries in the Cloud Console over a private network. For more information, see Query a Lightning Table in the Cloud Console.

API

Run Lightning Table queries from applications, dashboards, and services. You authenticate with a Global API key. A query that returns a large result or takes a long time runs asynchronously. For more information, see Query a Lightning Table with the API in Confluent Cloud.

MCP

Give AI agents real-time context. An MCP client connects to the Real-Time Context Engine, and an agent queries through the MCP tools. You authenticate with a Global API key, by signing in with your Confluent Cloud account, or with OAuth. For more information, see Query a Lightning Table with MCP in Confluent Cloud.

Confluent CLI

Run Lightning Table queries from a terminal or a script. You sign in with your Confluent Cloud user account. Each command runs one query and prints the result as a table, JSON, or YAML. For more information, see Query a Lightning Table with the Confluent CLI in Confluent Cloud.

JDBC

Connect SQL clients, business intelligence (BI) tools, and Java applications with the Confluent JDBC driver. You authenticate with a Global API key. For more information, see Query a Lightning Table with JDBC in Confluent Cloud.