<div dir="ltr"><div>Hi, <br><br>I have naively tried to execute this query:<br><br>models.select((r.date, models.count(r.date)) for r in models.Result if r.date >= datetime.date.today() - datetime.timedelta(days=10)).without_distinct()<br><br></div>With the aim of counting how many times each date appears. I was doing this with collections.Counter, but this doesn't scale to millions of results (far too much CPU and memory used). What query can I use to make the database do the work?<br><br>Thanks<br><div><div>-- <br><div class="gmail_signature">Regards,<br><br>Matthew Bell<br></div>
</div></div></div>