telemetry API endpoint fails for sats with many frames

Queries of the telemetry API endpoint fail with a 502/Bad Gateway when no satellite or a satellite with too many frames in the db is selected. Examples:

The underlying query takes to long and thus the request runs in a timeout.