I have this query which runs forever, its already running for 30 minutes in MySQL Workbench and counting... Is it possible to optimize it?
SELECT `p`.`id`, `ev`.`id`
FROM `participants` as `p`
JOIN `tbl_student` as `tst` on `p`.`First Name` = `tst`.`First Name` AND `p`.`Last Name` = `tst`.`Last Name`
JOIN `tbl_student_session` as `tsts` on `tst`.`id` = `tsts`.`studentId`
JOIN `tbl_courses` as `tc` on `tc`.`sessions` LIKE CONCAT('%',`tsts`.`sessionId`,'%')
JOIN `events` as `ev` on `tc`.`description` = `ev`.`body`
Tables:
participants: id, firstname, lastname
tbl_student: id, firstname, lastname
tbl_student_session: sessionId, studentId
tbl_courses: id, sessions, description
events: id, body
Where tbl_courses.sessions containts the sessions in this format: session1, session2, .... ,sessionn etc
UPDATE
I set limit to 10 rows and here is the execution plan:

EXPLAIN ..statement for the query. Moreover,LIKE %%in your query is definitely not going to be able to use any index whatsoever.tc.sessions), instead of having an actual relationship table that has one ID per row. This will never be fast until you fix your database design mistakes.tc.sessionsvalue is11, and thetsts.sessionIdis123, 11411, 456. Probably not what you want, isn't it?