Load only the necessary work fields when displaying series

Description

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:

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.

Assignee

Unassigned

Reporter

redsummernight

Roadmap

Series

Priority

Medium

Affects versions

Fix versions

None

Components

BackEnd

Difficulty

Medium

Milestone

Internal 0.9
Configure