Sequences

An eXtremeDB sequence is a dynamically sized, persistent array stored with a column-oriented layout. A sequence field belongs to an object, but its elements are stored separately from the object's fixed row layout so that large ranges can be scanned without reading unrelated fields.

Schema Declaration

    class Quote {
        char<8> symbol;
        sequence<time asc> timestamp;
        sequence<float> open;
        sequence<float> close;
        sequence<uint4> volume;

        hash<symbol> by_symbol[1000];
    };

The schema compiler generates field-specific storage functions for each sequence, and applications combine those functions with the generic iterator and analytics API.

Element Types

Sequence elements can use supported signed and unsigned integer widths, float, double, boolean, datetime, date, time, fixed-width char<N>, and supported fixed structures. The exact generated C type and iterator function depend on the schema element type.

Sequence elements may be nullable. This is independent of declaring the complete sequence field nullable: a nullable field has an object-level indicator, while nullable elements carry a per-position NULL bitmap.

Ordered Sequences

A field may be declared asc or desc. The runtime does not sort inserted data. It verifies that append, insert, and store operations preserve the declared order and returns MCO_E_SEQ_OUT_OF_ORDER otherwise.

Ordered fields receive generated range-search and join functions. Unordered fields can still be accessed by logical position, projected from an aligned range, mapped through arbitrary positions, and processed by generic sequence operators.

Aligned Columns

Several sequence fields in one object can represent aligned columns of a time series. Applications are responsible for preserving equal logical lengths and positional meaning. A typical query searches an ordered timestamp field and projects the resulting positional range onto value fields.

Alignment is logical. With RLE storage, independently compressed fields can have different physical run and tile boundaries even when their logical element counts match.

Logical and Physical Views

Generated counts, positions, ranges, and typed iterator functions operate on logical elements. The optional RLE implementation stores adjacent equal elements as physical runs, but typed traversal expands those runs. Direct calls to an iterator's low-level next callback expose physical tiles and require additional RLE and NULL handling.

Next Steps