Skip to content

Commit

Permalink
fix(persons): limit to maximum of 2500 distinct_ids for cross-db join
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Nov 6, 2023
1 parent 11b3745 commit d89468e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion posthog/models/person/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from posthog.models.utils import UUIDT

MAX_LIMIT_DISTINCT_IDS = 2500


class PersonManager(models.Manager):
def create(self, *args: Any, **kwargs: Any):
Expand Down Expand Up @@ -34,7 +36,7 @@ def distinct_ids(self) -> List[str]:
id[0]
for id in PersonDistinctId.objects.filter(person=self, team_id=self.team_id)
.order_by("id")
.values_list("distinct_id")
.values_list("distinct_id")[:MAX_LIMIT_DISTINCT_IDS]
]

# :DEPRECATED: This should happen through the plugin server
Expand Down

0 comments on commit d89468e

Please sign in to comment.