Materialization
Contents
Endpoints is currently in early beta. While in beta, endpoints is free to use.
We're always looking for feedback to improve endpoints, please reach out to us directly in app.
Materialization pre-computes your query results and stores them in S3. When someone calls your endpoint, PostHog returns the materialized results instead of running the query again - making responses much faster.
When to use materialization
Materialization is ideal when:
- Your data doesn't need to be real-time - Results are only as fresh as the last sync
- Your query is expensive - Complex queries with large datasets benefit the most
- You have high traffic - Avoid repeatedly running the same query
If you need real-time data or frequently update your query, stick with direct execution or use caching instead.
How to enable materialization
- Go to your endpoint's Configuration tab
- Enable the Materialization toggle
- Choose a sync frequency:
- Every hour - Updates every hour
- Every 6 hours - Updates four times a day
- Daily - Updates once per day
- Weekly - Updates once per week
PostHog will run the first materialization immediately. After that, it syncs on your chosen schedule.
Materialization status
On the endpoint page, you'll see one of these statuses:
- Completed - Latest materialization succeeded, results are available
- Running - Materialization is in progress
- Failed - Materialization encountered an error
If materialization fails, the endpoint falls back to direct execution until the next successful sync.
Limitations
Materialization is not available when:
- The endpoint has variables - Parameterized queries can't be pre-computed
- The endpoint is inactive - Only active endpoints are materialized
- You're running an older version - Only the latest version is materialized (see Versioning)
If you pass variables, filters, or query overrides when calling the endpoint, PostHog will run the query directly instead of using materialized results.
How materialization works with execution
When you call an endpoint:
- If materialization is enabled and complete, PostHog returns the materialized results
- If materialization is running or failed, PostHog executes the query directly
- If you pass parameters or request an older version, PostHog always executes directly
See Execution for more details on how PostHog chooses between materialized and direct execution.