Aggregation on a datetime field

Thanks for that! There are lots of things I wasn't thinking of that you solved there.

I dunno if it'd be worth restoring everything with the months pulled out. You'd make the index larger and reduce disk locality a bit to save running the script and the allocations it causes. If this isn't something that you do all the time I'd be happy with the script.

Now if you had to search by month, that is a different story!