I have following query:
select count(*) -- rp.tag
from submission
inner join post rp on submission.id = rp.submission_id
where user_name = ?1
and lower(rp.tag) like ('%verified%')
and not lower(rp.tag) like ('%unverified%');
If the result is greater than 0 I do something in my application for this user.
I run this query against a big list of users and it takes close to an hour to finish the whole process. And I only need to know whether the result is greater than 0.
Is there a way to finish the query early if any of the rp.tag
match my condition?