> Fetch the index of the TinyStore docs, every page as markdown, at https://tinyshed.org/tinystore/llms.txt

# TinyStore 0.12.0

TinyStore 0.12.0 came out on 24 November 2026. A counter of any number of
series now has a total, a folder of a database's files can be replaced whole
in one transaction, and a chart of a day by the hour reads in about half the
time it took. The release's binaries start a node with TLS, a node refuses
files no node copies, and search no longer pins the Unicode crates a Rust
program links.

- **Metrics**
  - [A total of any number of series](#a-total-of-any-number-of-series): a group past 1,000 series read in parts.
  - [A day by the hour, faster](#a-day-by-the-hour-faster): about half the time, without a byte of the file changing.
- **Files**
  - [Replace a folder whole](#replace-a-folder-whole): `list` and `clear` inside a database's transaction.

## A total of any number of series

A counter with more than 1,000 series in one group used to be a `limit`
error, even with `limit`, so a dashboard handed a metric's name had no total
to ask for. Now such a group is read in parts, 1,000 series at a time, and
answered whole on a page of its own. Ask with `limit`
([Aggregate in pages](https://tinyshed.org/tinystore/docs/guides/metrics/aggregates.md)):

```ts
const page = await store.metrics.aggregate({ name: 'views_total', since: '1d', op: 'increase', limit: 10_000 })
```

```python
page = await store.metrics.aggregate(name="views_total", since="1d", op="increase", limit=10_000)
```

```go
q := metrics.Query{Name: "views_total", Since: 24 * time.Hour, Op: metrics.Increase, Limit: 10_000}
page, err := metrics.Aggregate(ctx, store, q)
```

```rust
let page = stats.query().name("views_total").since(Duration::from_hours(24)).limit(10_000).aggregate(Op::Increase)?;
```

- Every `op` but a percentile adds up this way. A percentile ranks the
  samples of the whole group at once, so for it a group past 1,000 series is
  still a `limit` error (contract MET-20).
- Each part is read from a snapshot of its own, within a page's bounds: the
  store holds one part's bytes and the group's sums.
- An aggregate without `limit` is bounded as before.

## A day by the hour, faster

A chart of a counter's last day by the hour, 600 series of a sample a minute,
took 29 ms in a Linux container and 33 to 35 ms on Windows. It now takes
15.7 ms and about 20 ms. The day as one number went from 11 to 7 ms in the container, and a
day by a calendar's day in a time zone from 18 to 8 ms. Nothing changes in
the file, and every answer is the same. The two research rounds have the
numbers and how they were taken:
[metrics-day](https://github.com/tinyshed/research/blob/main/tinystore/reports/metrics-day-2026-11-24.md)
and
[metrics-day-reads](https://github.com/tinyshed/research/blob/main/tinystore/reports/metrics-day-reads-2026-11-24.md).

A percentile of a timer with more than 256 series in a group, by the hour,
was also read a bucket a page. A week of 1,800 series took 300 pages and five
seconds. A page now holds as many buckets as its bounds allow: in a test of
300 series by ten minutes, one page where there were 14.

## Replace a folder whole

Inside a transaction of the database a set of files is kept in, `list` now
pages a folder as the transaction left it, and `clear` removes it with the
transaction's commit or not at all. A new version of a pack may hold fewer
files than the old one: clear its folder, write its files and update its row
in one transaction
([Replace a folder whole](https://tinyshed.org/tinystore/docs/guides/sql/buckets-and-queues.md#replace-a-folder-whole)):

```ts
await db.tx(async tx => {
	const brands = tx.with(packs.folder('brands'))
	await brands.clear()
	await brands.put('icons/youtube.svg', svg)
	await tx.exec`update packs set version = 2 where name = 'brands'`
})
```

```python
async def replace(tx: tinystore.SqlTx) -> None:
    brands = tx.with_(packs.folder("brands"))
    await brands.clear()
    await brands.put("icons/youtube.svg", svg)
    await tx.exec("update packs set version = 2 where name = 'brands'")


await db.tx(replace)
```

```go
err = db.Tx(ctx, func(tx *sqldb.Tx) error {
	brands := packs.Folder("brands").In(tx)
	if err := brands.Clear(ctx); err != nil {
		return err
	}
	if _, err := brands.Put(ctx, "icons/youtube.svg", bytes.NewReader(svg)); err != nil {
		return err
	}
	_, err := tx.Exec(ctx, "update packs set version = 2 where name = 'brands'")
	return err
})
```

```rust
db.tx(|tx| -> tinystore::Result<()> {
    let brands = packs.folder("brands");
    let brands = tx.with(&brands);
    brands.clear()?;
    brands.put("icons/youtube.svg", &svg)?;
    tx.exec(sql!("update packs set version = 2 where name = 'brands'"))?;
    Ok(())
})?;
```

- `clear` removes what the folder held and what the transaction wrote there
  before it. What the transaction writes after it stays (contract BLOB-25).
- Readers see the old version until the commit, and then only the new one.

## Fixes

- The release's binaries, in the archives, the wheel and the image, refused
  to start a node whose `node.toml` has `[tls]`: they were built without
  TLS for nodes. They have it now.
- A node told to copy `records.db`, `metrics.db` or a database of `local/`
  copied nothing of it and said nothing. These files are each node's own; a
  node whose `files` names one is refused at its start, naming the file, and
  [Readers in another region](https://tinyshed.org/tinystore/docs/handbook/nodes/copies.md) says which files
  are never copied and what to do instead.
- Search pinned `unicode-segmentation` and `unicode-normalization` to one
  version each, so a Rust program that needed a newer one could not link
  `search`. They are ordinary requirements now. An index keeps the Unicode
  version its words were read by, and reads itself again in the background
  when a build links another; one opened with `rebuild: 'manual'` keeps
  serving and waits for `reindex`
  ([Rebuilds](https://tinyshed.org/tinystore/docs/guides/search/rebuilds.md)). An index written by 0.11 counts
  as read by what 0.11 was built with, so this release rebuilds nothing.

## Install

```sh for=bun
bun add @tinyshed/tinystore@0.12.0
npm install @tinyshed/tinystore@0.12.0
```

```sh for=python
pip install tinyshed-tinystore==0.12.0
```

```sh for=go
go get tinyshed.org/tinystore@v0.12.0
```

```sh for=rust
cargo add tinystore@0.12.0
cargo install tinystore-cli@0.12.0
```

0.12.0 adds no step to any engine's migrations: 0.11.0 still opens a store
0.12.0 has written. `list` and `clear` inside a transaction need a server of
0.12.0; an older one refuses them. The server image is
`ghcr.io/tinyshed/tinystore:0.12.0`.

Every commit since 0.11.0 is in the
[GitHub release](https://github.com/tinyshed/tinystore/releases/tag/v0.12.0).
