发布

  • [OPIK-6900] [BE] feat: add migration 000101 creating the traces_local_v2 shadow table (#7429)

    frostbyte_neo 发布于 2026-07-13 12:20:39 +00:00

    • [OPIK-6900] [BE] feat: add migration 000098 creating traces_local_v2 shadow table

    • feat(migration): add idx_traces_id min index to traces_local_v2

    Point lookups by id alone (TraceDAO.findById / WHERE id = :id with no
    project_id) can't use the primary key, since workspace_id leads the sort key.

    Adding it at table creation avoids a later MATERIALIZE INDEX mutation on a full
    table.

    id is the ORDER BY suffix and a UUIDv7 (time-ordered), so its values cluster
    within granules. minmax prunes both point lookups by id alone and the id-range
    predicates retention/read paths use (id >= .. AND id < ..).

    Addresses review feedback from thiagohora.

    • refactor(migration): use ZSTD(1) for id/project_id/workspace_id and truncation_threshold

    Per benchmarked review feedback: for the UUIDv7 id columns higher ZSTD levels
    did not improve (and slightly hurt) the ratio, so id/project_id move from
    ZSTD(3) to ZSTD(1). workspace_id and the constant truncation_threshold get an
    explicit ZSTD(1) instead of the server default. Header codec note updated to
    match.

    • feat(migration): pair a bloom-filter with the minmax index on traces_local_v2 id

    id-only lookups (project unknown) — getPartialById, findById, findByIds,
    project resolution — filter id (+ workspace_id) with no project_id, so the
    primary key can't serve them. minmax prunes the id-range predicates retention
    and read paths use, but within a week all ids share the timestamp prefix so
    minmax can't isolate an exact id; a bloom filter prunes those exact-match / IN
    lookups to a single granule. Keep both (as dataset_item_versions does on its
    id): idx_traces_id_minmax for ranges, idx_traces_id_bf for exact/IN. Addresses
    review feedback from @LiorF-BDBQ.


    下载附件