Hack Django ORM to calculate Median and Percentiles (Or make annotations great again!)

Hacks should be quick. And so should be the articles about them. Photo by Caspar Rubin on Unsplash Problem We needed to calculate medians, percentiles for some quantities for our own ETL system (note to self: write a post on this) grouped by certain fields. Some options we had: Extra: But Django says this will … Continue reading Hack Django ORM to calculate Median and Percentiles (Or make annotations great again!)

Blazingly fast querying on huge tables by avoiding joins

Tl;dr: Avoid joins on large tables and evaluate parts of queries beforehand to get 100–10,000x performance gains! As mentioned in a previous post, because of some of our tables growing in size, our queries started performing poorly which resulted in a performance hit to our most used APIs. It was time we revisit some of … Continue reading Blazingly fast querying on huge tables by avoiding joins