PostHog / PostHog/posthog

Big customers getting OOMs when saving cohorts.

Open
#20,719 4 comments 0 reactions 1 assignee View on GitHub

@dmarticus is already working on this.

Since Apr 27, 2026.

feature/cohorts feature/feature-flags performance team/feature-flags
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
7h 27m
Merged PRs (30d)
222

Description

In what situation are you experiencing subpar performance?

A big customer is getting OOMs when saving cohorts.

How to reproduce

List of all failing cohorts. EU also has quite a few

Example failing query. Unrestricted this peaks at >100GB

I played around with this a bit. By specifying which props to query in the subquery, it only peaks at 14GB of memory.
Example solution

Environment

Additional context

Thank you for your performance issue report – we want PostHog to go supersonic!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.