PlaidWeb / Publ

Flexible publishing system for the web
http://publ.beesbuzz.biz/
MIT License
40 stars 4 forks source link

Speed up auth filtering by many orders of magnitude #579

Closed fluffy-critter closed 1 month ago

fluffy-critter commented 1 month ago

Summary

Remove some full-table scans for authorization checks

Detailed description

It turns out that Pony's "lazy loading" of query results will immediately realize the entire query into a list at the drop of a hat, and you really need to use LIMIT and OFFSET to prevent that from happening.

Because of how authorization filtering works in Publ, count-based paginations were not using LIMIT and OFFSET. Now they are, and this has sped up rendering the global Atom feed on beesbuzz.biz by a significant factor.

Many huge thanks to @BearPerson / @AlsoBearPerson for helping me to figure out what was going on here, and being way more tenacious about digging through Pony than I am.

Test plan

Ensured that the paging and auth/paging test suites still behave correctly.

Got a site to show off?