-
New Feature
-
Resolution: Fixed
-
Normal
-
None
-
None
In order to avoid loading all track data just to figure out how long a medium (or release) is, we could use a view medium_track_durations.
SQL:
CREATE OR REPLACE VIEW medium_track_durations AS SELECT medium.id AS medium, array_agg(track.length ORDER BY track.position) FILTER (WHERE track.position = 0) AS pregap_length, array_agg(track.length ORDER BY track.position) FILTER (WHERE track.position > 0 AND track.is_data_track = false) AS cdtoc_track_lengths, array_agg(track.length ORDER BY track.position) FILTER (WHERE track.is_data_track = true) AS data_track_lengths FROM medium JOIN track ON track.medium = medium.id GROUP BY medium.id;