We sometimes load works ordered by their positions in a series like this:
This generates a SQL query that includes every single column from the works table, which is bad for 2 reasons:
The query is slower for getting unnecessary data.
We run migrations to remove seemingly unused columns from the works table, but existing Rails processes will still try to SELECT those columns, leading to errors on series and works in series. This did happen when we deployed AO3-5905, and we fixed the errors by restarting all Rails processes:
For reference, the errors we got were like:
Instances of this query:
Displaying the next/previous work links in a work meta: we need the work IDs, plus the fields used in the visible? check (posted, hidden_by_admin, and restricted).
Displaying the series: we do need everything for work blurbs. Not sure if we can easily limit the fields to load, but I'm noting it here anyway.
How to test:
Check that you can view a series and reorder the works in it without errors.
Check that you can view the blurbs of works in a series, with the expected link to the series, and without errors.
Check that you can view the meta boxes of works in a series, with the expected links to the series + the next/previous works, and without errors.