Skill 103 · Querying PostHog Data
Subchapter 103.45
references/models-flags-experiments.mdMarkdown4 KBView on GitHub
Feature flags control rollouts of new features and are used for A/B testing.
These are the only columns exposed via HogQL — the full flag model (e.g. active, ensure_experience_continuity, last_called_at, rollback settings) is not queryable here; fetch the flag via the feature flag API tools instead.
| Column | Type | Nullable | Description |
|---|---|---|---|
id | Integer | NOT NULL | Flag id. |
team_id | Integer | NOT NULL | |
key | String | NOT NULL | Flag key used by SDKs to evaluate the flag. |
name | String | NOT NULL | Human-readable flag name/description. |
filters | JSON | NOT NULL | JSON targeting rules, variants, and release conditions. |
rollout_percentage | Integer | NOT NULL | Top-level rollout percentage (0-100); detailed rules live in filters. |
created_by_id | Integer | NULL | User who created the flag. |
created_at | DateTime | NOT NULL | When the flag was created. |
deleted | Integer | NOT NULL | 1 if the flag has been deleted, 0 otherwise. |
{
"groups": [
{
"properties": [...],
"rollout_percentage": 50,
"variant": "test"
}
],
"multivariate": {
"variants": [
{"key": "control", "rollout_percentage": 50},
{"key": "test", "rollout_percentage": 50}
]
},
"payloads": {
"control": {"value": "A"},
"test": {"value": "B"}
},
"aggregation_group_type_index": null
}system.experiments.feature_flag_idsystem.surveyskey must be unique per teamaggregation_group_type_index enables group-based targeting (company-level flags)Experiments are A/B tests that compare variants against a control group.
These are the only columns exposed via HogQL — the full experiment model (e.g. deleted, conclusion, metrics, metrics_secondary, stats_config, exposure_criteria, holdout_id, type) is not queryable here; fetch the experiment via the experiment API tools instead.
| Column | Type | Nullable | Description |
|---|---|---|---|
id | Integer | NOT NULL | Experiment id. |
team_id | Integer | NOT NULL | |
name | String | NOT NULL | Experiment name. |
description | String | NOT NULL | Experiment description/hypothesis. |
created_by_id | Integer | NULL | User who created the experiment. |
created_at | DateTime | NOT NULL | When the experiment was created. |
updated_at | DateTime | NOT NULL | When the experiment was last updated. |
filters | JSON | NOT NULL | JSON definition of the experiment’s goal metric filters. |
parameters | JSON | NOT NULL | JSON experiment parameters (e.g. sample size settings). Flag config such as variants lives on the linked feature flag’s filters, not in this column. |
start_date | DateTime | NOT NULL | When the experiment was launched; NULL if not started. |
end_date | DateTime | NOT NULL | When the experiment was concluded; NULL if still running. |
archived | Integer | NOT NULL | 1 if the experiment is archived, 0 otherwise. |
feature_flag_id | Integer | NOT NULL | Feature flag controlling variant assignment; joins to feature_flags.id. |
{
"minimum_detectable_effect": 5,
"recommended_running_time": 14,
"recommended_sample_size": 1000,
"custom_exposure_filter": {...}
}Variant keys and rollout percentages live on the linked flag. Read them from
filters.multivariate.variants in system.feature_flags.
feature_flag_id -> system.feature_flags.id (required)start_date is NULLdeleted column to filter them out; confirm via the experiment API tools when deletion status matters