CREATE VIEW "ur_ingest_session_files_stats_latest" AS
SELECT iss.*
FROM ur_ingest_session_files_stats AS iss
JOIN ( SELECT ur_ingest_session.ur_ingest_session_id AS latest_session_id
FROM ur_ingest_session
ORDER BY ur_ingest_session.ingest_finished_at DESC
LIMIT 1) AS latest
ON iss.ingest_session_id = latest.latest_session_id