I have one table called users
with a PRIMARY key on users.zbid
. However, all SELECT
queries run on it include the WHERE
clause cid='$cid' AND zbid='$zbid'
. Should I add an index for cid
or a multi-column index for cid,zbid
? I know the WHERE
clause on cid
seems redundant as zbid
is PRIMARY
, but it's mainly there as a precautionary step, each cid
designates a different forum, and in case something went wrong I don't want every forum to be effected.
Secondly, I have another table called notifications
. The only query that is run on this table uses the where clause cid='$cid' AND zbid='$zbid'
, should I add them both as individual indexes or just one? Why?