Using EXPLAIN for the query below shows
SELECT cha.cid AS cid,
       cha.data AS dl
FROM cha, c_users
WHERE uid = 808
AND cha.cid = c_users.cid;
- it does a full scan on chatable
- uses the multi column index(cid,uid) fromc_users.
Why doesn't it not use the primary key index from cha and rather does a full table scan. Is there a better way to optimise the query/table.
Edit: cha.cid is my primary key. Added after the comment below.