All technologies

Data & Architecture

Custom data structures where standard ones fall short

Most applications get by with a good database and the right indexes. Some problems need more: overlapping time ranges, prefix search across large datasets, paths through a network or a history that must never change. Then we choose the right data structure and implement it in the database, in TypeScript or, where microseconds matter, in Rust or Go.

Choosing the right data structure often matters more for speed and correctness than adding more server hardware.

Data flow

How Custom data structures fits into your processes

  1. Measurement
  2. Model
  3. Prototype
  4. Benchmark
  5. Operations
We first measure the problem, choose a model, test it as a prototype against real data and then put it into production.

Use cases

What we build with Custom data structures

  • Time ranges and history

    Check overlapping time ranges and record bitemporally what was valid and known when.

  • Search and prefixes

    Tries for autocomplete, Bloom filters for fast pre-checks.

  • Networks and routes

    Calculate shortest paths, reachability and centrality in networks.

  • Spatial indexes

    R-trees, H3 and Geohash for radius, tiles and areas.

Typical projects

Why companies bring us in

  1. 01

    What applied when?

    Starting point
    Contracts and terms change retroactively, and later you need to prove what was known at which point in time.
    Solution
    We store data bitemporally with business validity and recording time; changes are never overwritten.
    Result
    Every earlier state can be reconstructed exactly, including for audits and evidence.
  2. 02

    Paths through a network

    Starting point
    An application needs to calculate connections, dependencies or routes across a large network.
    Solution
    We keep the network in a compact in-memory structure and calculate shortest paths and centrality selectively.
    Result
    Results are available with response times that queries on tables could not achieve.
  3. 03

    Edit together

    Starting point
    Several people edit the same data at the same time, sometimes offline, and changes overwrite each other.
    Solution
    We use CRDTs that merge changes without a central lock.
    Result
    Everyone ends up with the same state, even after offline periods.

From practice

Custom data structures in our projects

  • An optimization solver computes timetables and substitution plans for schools on a dedicated data model.

Approach

How we introduce Custom data structures

  1. 1

    Understand the problem

    Measure data volumes, access patterns and response time requirements.

  2. 2

    Choose a structure

    Review proven methods before we build something of our own.

  3. 3

    Implement and test

    Implementation with tests against a simple reference solution.

  4. 4

    Measure and operate

    Benchmarks with real data, monitoring in production.

Result

What you get from us

  • Analysis of data volumes and access patterns
  • Design of data model and algorithm
  • Implementation in SQL, TypeScript, Rust or Go
  • Tests against a simple reference solution
  • Benchmarks with real data
  • Documentation of assumptions and limitations
create extension if not exists btree_gist;

create table miete_versionen (
  vertrag_id uuid not null,
  miete numeric(12, 2) not null,
  gueltig daterange not null,
  erfasst tstzrange not null default tstzrange(now(), null),
  exclude using gist (vertrag_id with =, gueltig with &&, erfasst with &&)
);

-- Welche Miete galt am 1. März, nach Wissensstand vom 15. Januar?
select miete from miete_versionen
where vertrag_id = $1
  and gueltig @> date '2026-03-01'
  and erfasst @> timestamptz '2026-01-15 00:00+01';
Bitemporal history in PostgreSQL: validity and recording time as ranges, with the database ruling out overlaps.

Quality

What we watch for with Custom data structures

  1. 1

    Measure first

    We only build something custom when measurements show that proven solutions are not enough.

  2. 2

    Keep a reference

    Every optimized structure is tested against a simple, obviously correct version.

  3. 3

    False positives

    Bloom filters give a certain no, but only a probable yes. The workflow must take this into account.

  4. 4

    Half-open time ranges

    We store time ranges consistently as half-open so adjacent ranges do not overlap.

  5. 5

    Memory and restart

    In-memory structures need a plan for building, updating and restarting.

Comparison

Standard solution or Custom data structure?

Standard solution

Effort
Low, available immediately
Fit
Built for typical cases
Response times
Sufficient for most cases
Knowledge in the team
Widely used

Custom data structure

Effort
Requires design, testing and maintenance
Fit
Tailored to your access pattern
Response times
Significantly faster where needed
Knowledge in the team
Requires documentation and handover

We start with the standard solution and only build custom structures where measurements justify it.

Custom data structures

Common questions

Tap a question.