Data modeling

PostHog provides powerful tools to clean, enrich, and model your data into the exact shape you need for downstream use.

Note: PostHog modeling is in Beta. It's great for product teams who have light modeling workloads today, with support for advanced use-cases in active development.

If you have advanced modeling needs, we recommend you connect your favorite modeling tooling such as dbt to your PostHog DuckDB warehouse.

Step 1: Create reusable queries with views

PostHog's modeling workflow starts with creating views for your data. This allows you to define custom transformations, joins, and aggregations using HogQL (PostHog's SQL dialect), which can be used as reliable, structured foundations for data analysis.

Step 2: Create models for scalability

Then, save those views into models (aka materialized views) in the data warehouse for fast querying, cost saving, and integration with BI tools.

Models are refreshed on a schedule, as frequently as every 5 minutes or as long as monthly.

Materialize view

You can view your models in a DAG, or a visual graph of all model dependencies.

DAG view

Features

  • Join multiple sources: Combine data from different tables and sources
  • Create calculated fields: Add derived metrics and computed columns
  • Build aggregations: Create summary tables and rollups
  • Save as models: Store complex queries as reusable views, materialized for speed
  • Version control: Track changes to your data models over time Coming soon
  • Git & vcs integrations: Sync your models with your Git repository for collaboration Coming soon
  • DAG visualizations: view a graph of all model node relationships, and execute workflows based on lineage Coming soon

Learn how to model your data →


Common modeling use cases

User identity resolution

  • Merge anonymous and identified user sessions
  • Link user IDs across different systems
  • Create a unified customer profile

Revenue attribution

  • Connect product usage to revenue data from Stripe
  • Calculate customer lifetime value
  • Attribute revenue to specific features or campaigns

Data standardization

  • Normalize event names across different platforms
  • Standardize timestamp formats and timezones
  • Map custom properties to a consistent schema

Privacy compliance

  • Automatically remove or hash PII
  • Implement data retention policies
  • Apply GDPR/CCPA compliance rules

Community questions

Questions about this page? or post a community question.