Hello,
This is the table structure:
for_id
from_id
for_folder
from_folder
deleted
The number 2 represents my ID and this is the query:
SELECT *
FROM poruke_konverzacija
WHERE (
(
for_id =2
AND for_folder = "inbox"
)
OR (
from_id =2
AND from_folder = "inbox"
)
)
AND deleted !=2
I have near 500k records on that table and when i run explain, this is what i get:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE poruke_konverzacija ALL obrisano,za_id,od_id NULL NULL NULL 456884 Using where; Using filesort
I have indexed for_id from_id for_folder from_folder and the query is really slow. Is there any other way to do so and get the same results ?