How can I optimize a query where a IN clause is replaced with multiples UNION ALL?
if slow_view don't have too many records, you can consider fetching all the records to application and apply the filter in the application side result set.
This approach helped me in a specific case to reduce the database load.