SQL query insights: LIMIT
seems to break beyond some arbitrary/magic number on my query
#20255
Closed
1 of 4 tasks
Labels
bug
Something isn't working right
Bug description
I have a manual SQL query insight (due to limitations like #20251) that produces a table of stats per "question" (we have an interest quiz/questionnaire):
(If this query feels messy: #20250, #20252, etc.)
Example output:
If I omit a
LIMIT
clause in my query (as above), PostHog displays the first 100 results and then this message below it:But if I add a
LIMIT
clause with a higher number, e.g.LIMIT 200
, no results get returned at all:I trial-and-error'ed (binary searched) and found that the exact number where this happens is 135. E.g.
LIMIT 134
works and returns 134 results, whileLIMIT 135
doesn't work / returns no results at all.I thought maybe the bug here was
LIMIT
breaking past the actual total number of results. But what's wild is that if Icount(distinct ...)
the questions, we actually have 154 total results.So the threshold here (135) is surprising and seems arbitrary. But the more important bug is that specifying a higher
LIMIT
is silently breaking the query — returning no results at all, with no error message.How to reproduce
I thought maybe this was a general bug or limitations (no pun intended), but I can't repro this with a simple one-off query that e.g. just reads/aggregates from the
events
table (up toLIMIT 1000
). Is there something about my query that's triggering a bug?Here it is on our hosted cloud instance if helpful:
https://us.posthog.com/project/50689/insights/14ybw5Gn
Environment
docker compose
, version/commit: [please provide]Additional context
Thank you for your help!
The text was updated successfully, but these errors were encountered: