>
> Given the lack of indexes on the one table that is shown I suspect this is
> the most likely cause (FK + indexes)
>
right, there should be an index on ts. If it is a 9.5 AND the rows are ordered
on ts a BRIN-index would be fine.
If not - a normal index. How many rows contains the table?
--
Andreas Kretschmer
http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services