* recorder: Apply filter in the outer query too
Function _get_start_time_state_for_entities_stmt() produced a query which
is dead-slow in my installation. On analysis, the outer query produced
millions of rows which had to be joined to the subquery. The subquery has
a filter which would eliminate almost all of the outer rows.
To speed up the query, apply the same filter to the outer query, so way
less rows have to be joined.
This reduced the query time on my system from more than half an hour to
mere milliseconds.
* lint
* merge filter
---------
Co-authored-by: J. Nick Koston <nick@koston.org>