Skip to main content
Applies to: Embedded ✅, Enterprise ✅ The real time engine puts an LSM-style write tier in front of a table, turning many small writes into a few large commits. This page covers enabling it and writing to a table; for querying an RTE table, see RTE reads. table.enable_rte(spec) is the same call on both connections, but what it does underneath differs:
  • Embedded runs Lance’s MemWAL ShardWriter directly in your process — the WAL buffer, memtables and SSTables all live wherever your table does, and there is no separate serving layer to scale or configure.
  • Enterprise forwards the call to the server, which runs it on a dedicated, horizontally scalable WAL-node tier instead of your table’s query-serving fleet. See Distributed RTE Write for how that tier shards a table’s writes and the throughput limits that come with it.

Getting started

1. Create a table with a primary key

RTE deduplicates writes by primary key. Create the table with a non-nullable key column, then declare it with set_unenforced_primary_key. The key is a single int32, int64, string, or binary column, and cannot be changed once set. The table below holds frames captioned and embedded as they stream in from a live camera feed, such as a robot recording episodes into a dataset shaped like LeRobotDataset’s frames table — frame_id is the primary key so a re-captioned frame upserts in place:
Or in SQL:

2. Create indexes

By default, RTE maintains every supported index on the table, including indexes created after it is enabled. A scalar index on the primary key is required for partial updates and deletes.

3. Enable RTE

Or in SQL:

4. Write

On an RTE table, an upsert through merge_insert is the only way to write rows. Use the form below exactly: when_matched_update_all() with no filter, plus when_not_matched_insert_all(). Other merge_insert forms, such as conditional updates or deleting rows missing from the source, are rejected.
Writes go through merge_insert on the primary key, and are visible to queries immediately — see RTE reads for querying them back:
Partial updates. Send the primary key plus only the columns you want to change; omitted columns keep their current values. This requires a scalar index on the primary key. A re-captioning job, for example, only touches caption:
Deletes. The predicate must bind the primary key to literal values. Ranges, OR, and filters on other columns are rejected. Deletes require a scalar index on the primary key.

Disabling RTE

Stop writes and wait for in-flight writes to finish, then flush pending writes into the base table and disable. checkpoint_rte() only drains writes that existed when it started, so anything written during the checkpoint can be left behind. disable_rte() is rejected while the write-ahead log still holds rows, so run checkpoint_rte() first.

Write throughput

RTE acknowledges a write as soon as it is durable in the write-ahead log, so ingest is no longer limited by how fast the table can commit. On Embedded, durability means your local disk or object store, so throughput is bounded by your own machine’s resources. An Enterprise table can be split into shards that write independently, with each shard’s durable-append throughput bounded by its WAL node’s own capacity — measured, not an enforced cap. See Distributed RTE Write for the numbers.

Next steps