Indexes database - Problem with queries that use many tables

0

My database is slow, I activated slow queries, and the only query executed with more than 1 second of response (this is too much for my server) is as follows:

SELECT 'user_id' 
FROM Wo_Users 
WHERE 'user_id' IN (SELECT 'following_id' FROM Wo_Followers WHERE 'follower_id' = 3365 
  AND 'following_id' <> 3365 
  AND 'user_id' NOT IN (SELECT 'blocked' FROM Wo_Blocks WHERE 'blocker' = '3365') 
  AND 'user_id' NOT IN (SELECT 'blocker' FROM Wo_Blocks WHERE 'blocked' = '3365') AND 'active' = '1') 
  AND 'lastseen' < 1544583557 
  AND 'active' = '1' 
ORDER BY 'lastseen' DESC 
LIMIT 6;

I think there may be a shortage of indexes, but here's the question: How to use indexes in a query that uses concurrent tables?

"Wo_users", "Wo_Followers" and "Wo_Blocks" are used in this query.

    
asked by anonymous 12.12.2018 / 12:02

0 answers