DEV Community

Mackenzie
Mackenzie

Posted on • Originally published at mackenzie.morgan.name

Elixir Wizards Talk: "Dealing With a Monster Ecto Query"

Last month, I spoke at the first-ever Elixir Wizards Conference. It was a lightning talk walking through a refactor I did before the 2020 US Presidential Election, titled "Dealing With a Monster Ecto Query."

I work for a news company, so the presidential election is a huge deal; we can't have downtime. I knew which query was our bottleneck, so I optimized it right before the election. This took advantage of a few Elixir features, like atoms, the pin operator, and concurrency primitives.

You can watch the talk below:

Source code for slides

Top comments (3)

Collapse
 
dkuku profile image
Daniel Kukula • Edited

Hi @maco , great example but is there any chance that you can compare your approach with having the 4 separate queries connected with union or union_all instead sending 4 queries? hexdocs.pm/ecto/Ecto.Query-macro-u...

Collapse
 
tfantina profile image
Travis Fantina

Wow, "Elixir Wizards" is a great name for an Elixir conference. I will give this a watch when I have some downtime.

Collapse
 
maco profile image
Mackenzie

Elixir Wizards is actually a podcast originally, and they decided to start a conference.