Live queries are SurrealDB's way to push changes to a client. Running a LIVE SELECT opens a subscription sends notifications whenever matching records appear, change, or disappear, without needing to directly poll the database to do so.
That fits interactive UIs, dashboards, and small collaboration features. For replaying history or catching up a batch pipeline, use changefeeds and SHOW CHANGES instead.
The full grammar and edge cases live under LIVE SELECT in the reference. Below is how to think about subscriptions and what to watch for in production.
Starting a subscription
By default, creates and updates deliver the full record; deletes return nothing unless you add a clause like RETURN BEFORE. You receive a UUID as soon as the live query is registered. This UUID can later be passed in to a KILL statement when you want to stop.
Message layout on the wire is described in the live query / WebSocket protocol section.
DIFF mode
If you prefer patches instead of whole documents on update, use DIFF. Updates arrive as JSON Patch-style arrays, which can be smaller and easier to merge on the client when records are large.
Filtering with WHERE
You can narrow the subscription the same way you would a normal SELECT: only rows that match your predicate participate.
Consistency and security
Notifications reflect committed work, so a live event will not take place if a transaction is rolled back.
Under heavy concurrency, the system makes a best effort to preserve sensible ordering, but you should not assume a total order across all writers that matches commit order in every edge case.
Parameters in live queries
From v3.0.0 onwards you can use session parameters in live queries, such as by binding names with LET before you open the subscription.
Where to read more
Changefeeds — replay and
SHOW CHANGESReal-time best practices — wider event-driven patterns