Skip to content

Limitations

import { Aside } from '@astrojs/starlight/components';

slate wraps Erlang's DETS, which has several inherent limitations. Understanding these helps you choose the right storage approach.

DETS tables are limited to 2 GB per file. This is a hard limit in the DETS implementation and cannot be configured. If a table exceeds this size, operations will return Error(FileSizeLimitExceeded).

Unlike Erlang's ETS (in-memory storage), DETS does not support ordered_set tables. Only set, bag, and duplicate_bag are available. Keys are stored in an unspecified order.

DETS performs disk I/O on every read and write. This makes it unsuitable for high-frequency operations where latency matters. For performance-critical reads, consider loading data into ETS at startup and using DETS only for persistence.

If a DETS table is not closed properly (e.g., due to a crash), pending writes may be lost and the file may need repair on the next open. Use with_table for short-lived operations to ensure tables are always closed.

By default, slate uses AutoRepair, which automatically repairs improperly closed tables. You can also use ForceRepair to always repair, or NoRepair to return an error instead.

DETS is a BEAM feature. slate only works with Gleam's Erlang target — there is no JavaScript target support.

DETS table names are derived from the file path, converted to an Erlang atom. Erlang atoms are never garbage collected, so each unique file path permanently consumes an atom. This is rarely a problem in practice, but avoid opening tables with dynamically generated paths in a loop.

No concurrent access from multiple OS processes

Section titled “No concurrent access from multiple OS processes”

A DETS file should only be opened by a single OS process at a time. Multiple Erlang processes within the same BEAM node can share a table, but opening the same file from separate BEAM nodes or OS processes can lead to corruption.

FeatureDETS (slate)ETSSQLiteMnesia
Persistence Disk Memory only Disk Disk
Max size2 GBRAMUnlimitedUnlimited
Query capabilityKey lookup, foldKey lookup, match specsFull SQLMatch specs, QLC
Ordered keys (ordered_set)
External dependencyNone (OTP built-in)None (OTP built-in)YesNone (OTP built-in)
PerformanceDisk I/O boundMicrosecondsVariesVaries
Concurrent processesSingle nodeSingle nodeMultipleDistributed