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. I am looking in to ways to speed this up. The problem I see is that I am doing a count when I don't really need it. As I said allAnd I only need to know if iswhether the result is greater than 0 or not.
Is there a way to finish the query early if any of the rp.tag
match my condition?