Examine the appointments table definition which contains one million rows: CREATE TABLE `appointments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`attendant_id` int(11) NOT NULL,
`attendant_session_id` int(11) NOT NULL,
`start` datetime NOT NULL,
`end` datetime NOT NULL,
`date` date NOT NULL,
`created_by` varchar(20) NOT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`payment` int(11) NOT NULL DEFAULT '0',
`credit` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Now, examine this statement which executes successfully:
SELECT attendant_id,
payment,
credit
FROM appointments
WHERE attendant_session_id = 510
AND created_by = 'jsmith';
Which statement will improve query performance?