Elektrine lite

← Feed

@cjwatson@mastodon.ie

Post #2471311

2026-05-07 18:37 UTC

I might have some #Django friends who have experience with this sort of thing. I spent a good chunk of today doing #PostgreSQL query optimization: not indexes, but rather "if this query had a different but semantically-equivalent structure, the planner would understand how to make it an order of magnitude faster". I trimmed several seconds off the rendering time of some views. All very satisfying. (1/3)

Replies (2)

  • @cjwatson@mastodon.ie 2026-05-07 18:37

    While you can get big improvements here with relatively small changes, it's also easy to introduce problems like this, so ideally I'd have regression tests. Django has QuerySet.explain, so if I set things up right I could assert things about its output, like "no seq scans" or "no nested loops". I imagine I'd use the JSON output format to help with parsing. (2/3)

    Open ##2847214

  • @cjwatson@mastodon.ie I'm making a note here: “huge success!” It's hard to overstate my satisfaction.

    Open ##2847219