I have a database with millions of record and I have to search and show the records based on search key. I am using PHP to communicate with MySQL and I can do it in traditional way but it's not a optimized way to do that.
I want to this with MySQL procedures, is this a optimized way? If yes then how we can create procedure and how to use in PHP code? I am using this code to create:
DELIMITER $$
DROP PROCEDURE IF EXISTS `getExerciseForSearchKey` $$
CREATE PROCEDURE `getExerciseForSearchKey`(IN searchText varchar(255),OUT result varchar)
BEGIN
SELECT * FROM exercisetemplate WHERE key like '%searchKey%';
END $$
DELIMITER ;