Storage architecture

ScopeDB is designed for event analytics, where a query often reads a subset of fields from a large table and filters or aggregates many events. Its storage engine follows a simple principle: avoid reading data that cannot affect the result.

ScopeDB Cloud manages storage for you. You work with tables, queries, retention, and clustering—not storage infrastructure.

Columnar storage

ScopeDB tables keep the familiar model of rows and columns, while the storage engine organizes values by column. An analytical query can therefore read the columns it needs without reading every field from every event.

This is especially useful for wide event tables. A query that selects time and service does not also need to read a large message or semi-structured payload column unless the query references it.

Index pruning

ScopeDB can use index pruning to avoid reading segments that cannot match a query predicate. Pruning only removes segments known not to match; candidate data is still evaluated normally.

For example, this query references two columns and combines two filters:

FROM events
SELECT time, service
WHERE time >= NOW() - 'PT1h'::interval
  AND service = 'checkout'
Column selection and index segment pruningThe query reads two of four columns. A time filter may match segments one through three, while a service filter may match segments two through four. Their intersection leaves segments two and three to scan.Columnar storageRead referenced column datatimeread10:0510:18servicereadcheckoutauthmessagenot readpayment approvedcache missvarnot read{ region: … }{ version: … }Index pruningcandidateskipS1S2S3S4S5time rangecandidatecandidatecandidateskipskipservice = 'checkout'skipcandidatecandidatecandidateskipANDsegments to scanskipscanscanskipskip2 of 4 columns readIn this example, scan 2 of 5 segments

Index pruning is a performance optimization, not a requirement for query correctness. When no segment can be ruled out, ScopeDB evaluates the query against the relevant columnar data normally.

Clustering with CLUSTER BY

CLUSTER BY is a table-layout hint that keeps rows with similar key values close together within each partition. It does not change query results or guarantee their order. Use ORDER BY when result order matters.

The query in the first diagram combines an equality filter on service with a range filter on time. For that recurring access pattern:

ALTER TABLE events
CLUSTER BY service, time;

The illustration uses the same filter shape with a fixed 10:00 cutoff. It compares the same rows in an unclustered layout and an illustrative clustered layout; only the distribution of values changes.

Clustering concentrates matching events into fewer segmentsThe same sixteen events are spread across four candidate segments before clustering. After clustering by service and time, checkout events are together in one candidate segment, allowing the other three segments to be skipped for the example filter.Example filterservice = 'checkout' AND time >= 10:00Before clustering4 of 4 may match in this exampleS1candidateapi · 09:40auth · 10:34checkout · 10:05search · 09:48S2candidateapi · 10:12auth · 09:42checkout · 10:18search · 10:50S3candidateapi · 09:52auth · 10:21checkout · 10:26search · 09:38S4candidateapi · 10:45auth · 09:55checkout · 10:40search · 10:30Illustrative layout with CLUSTER BY service, timeAfter clustering1 of 4 may match in this exampleS1skipapi · 09:40api · 09:52api · 10:12api · 10:45S2skipauth · 09:42auth · 09:55auth · 10:21auth · 10:34S3candidatecheckout · 10:05checkout · 10:18checkout · 10:26checkout · 10:40S4skipsearch · 09:38search · 09:48search · 10:30search · 10:50Candidate segments4 before → 1 after in this example

Key order matters. Put the expression used by the most important recurring filters first. Here, service groups related events first, while time organizes values within each service. Choose a small, stable set of expressions that reflects important recurring queries.

When filters align with the cluster keys, clustering can improve data locality and make index pruning more effective. It does not guarantee that fewer segments will be scanned. The benefit depends on key order, value distribution, and the query filters.

Partitioning defines broad data groups, clustering improves locality inside each group, and index pruning can skip segments that cannot match a query. ScopeDB Cloud manages the physical organization after you define the key. See CREATE TABLE for the complete syntax and expression rules.

How the pieces work together

At a high level, ScopeDB follows this path:

  1. Identify the columns required by the query.
  2. Use index pruning to rule out segments that cannot match the query.
  3. Read the required columnar data from the remaining candidates, apply the query operations, and return the result.

Column selection reduces the width of a read. Index pruning reduces the segments that need to be considered. A cluster key aligned with recurring filters can concentrate matching values and make that pruning more effective.

Performance optimization priorities

DirectionWhat it reduces
Column projectionReads only the columns referenced by the query.
Index pruningRules out segments that cannot match the query predicates.
ClusteringKeeps similar values together, creating more opportunities for pruning.

Start with representative queries and optimize the paths that matter. Select only the fields a query needs, and choose cluster keys for stable, recurring filter patterns.

Continue with Query data for query patterns and Add indexes for ways to improve pruning for recurring access patterns.