I recently took a simple skills test to which I was given the feedback:
"There is one small indexing optimisation which could improve performance."
The skills test involved creating a birthday e-card online app; users sign up, then on their birthday an email is sent to them. I was to presume this is on a Linux server running a mysql database with around 4 million records.
I've tried my best to research further issues with indexing on my database, but to my best research and knowledge, im struggling to find any improvements. I'd really appreciate any pointers here so I can learn where I went wrong;
Database:
CREATE TABLE `birthdayCard`
(
`Email` VARCHAR(255),
`FirstName` CHAR(30),
`LastName` CHAR(30),
`Dob` DATE,
PRIMARY KEY (Email),
INDEX(Dob)
);
Query:
SELECT * FROM `birthdayCard`
WHERE MONTH(Dob) = MONTH(NOW())
AND DAY(Dob) = DAY(NOW());