I have a table like this
CREATE TABLE `tbl` (
`id` int(10) unsigned NOT NULL,
`pid` int(10) unsigned NOT NULL,
`cid` int(10) unsigned NOT NULL,
`name` int(11) DEFAULT NULL,
`desc` varchar(500),
`deleted` tinyint(1) unsigned NOT NULL DEFAULT 0,
`createdAt` datetime DEFAULT NULL,
PRIMARY KEY `pid_cid` (`pid`,`cid`)
) ENGINE=InnoDB
WHERE
clause of select queries are those:
where pid=pid [and deleted = 1];
where cid=cid [and deleted = 1];
where pid=pid and cid=cid [and deleted = 1];
- Should I index
pid
andcid
separately? - Should I index
deleted
?