D
Deleted member 232995
Guest
What do I want to achieve with the query?
I would like to count the reactions that a user has received. And only in a certain forum - in which - this is decided by the PostId respectively the ThreadId.
Unfortunately, the query needs about 5 seconds for each query. This is a mammoth task with the mass of posts approx. 9 million, topics approx. 500k and users approx. 200k.
Is there a way to collect the data faster here? do I have a thinking error in the query?
I would like to count the reactions that a user has received. And only in a certain forum - in which - this is decided by the PostId respectively the ThreadId.
Unfortunately, the query needs about 5 seconds for each query. This is a mammoth task with the mass of posts approx. 9 million, topics approx. 500k and users approx. 200k.
Is there a way to collect the data faster here? do I have a thinking error in the query?
Code:
SELECT COUNT(*)
FROM xf_reaction_content as rc
LEFT JOIN xf_post as p ON(rc.content_id = p.post_id AND rc.content_type = 'post')
LEFT JOIN xf_thread as t USING(thread_id)
WHERE
t.thread_id != 9
AND t.node_id = 2
AND rc.reaction_date <= 1625617542
AND rc.content_user_id = 2
AND reaction_id = 2