I simplified the query, but it's not making a huge impact. I want this query to take less than 500ms.