Roll out the columnar-backed segment membership feature to SaaS.
Feature flags
segment_membership_inspection (API Flagsmith on Flagsmith). The idea is to a) gate the SaaS rollout per organisation and b) maintain a denylist for spend outliers.
Core concept
flagsmith-sql-flag-engine translates a segment's predicate tree to a SQL WHERE expression. Identities are mirrored from DynamoDB to ClickHouse via CDC (Dynamo Streams → S3 → ClickPipes → ClickHouse). Per-(segment, environment) counts cache in core Postgres on the SegmentMembership model. Members listing streams matched identities from ClickHouse, overrides enriched with the canonical Dynamo record.
The IDENTITIES table is ReplacingMergeTree(inserted_at) ORDER BY (environment_id, id) with traits in a JSON column. Refresh queries use FROM IDENTITIES AS i FINAL to dedupe at read time so counts always reflect the latest backfill snapshot.
RFC: Segment Membership Inspection (columnar) (private to Flagsmith team).
Roll out the columnar-backed segment membership feature to SaaS.
Feature flags
segment_membership_inspection(API Flagsmith on Flagsmith). The idea is to a) gate the SaaS rollout per organisation and b) maintain a denylist for spend outliers.Core concept
flagsmith-sql-flag-enginetranslates a segment's predicate tree to a SQLWHEREexpression. Identities are mirrored from DynamoDB to ClickHouse via CDC (Dynamo Streams → S3 → ClickPipes → ClickHouse). Per-(segment, environment) counts cache in core Postgres on theSegmentMembershipmodel. Members listing streams matched identities from ClickHouse, overrides enriched with the canonical Dynamo record.The IDENTITIES table is
ReplacingMergeTree(inserted_at) ORDER BY (environment_id, id)with traits in aJSONcolumn. Refresh queries useFROM IDENTITIES AS i FINALto dedupe at read time so counts always reflect the latest backfill snapshot.RFC: Segment Membership Inspection (columnar) (private to Flagsmith team).