Possible Duplicate:
Slow query performance
My database contains 20,000 rows and the following query is slow. Please help me to speed this up.
SELECT r.report_id, r.user_id,u.user_name,u.user_mail,
d.department_name,r.report_comment, r.report_target_date,r.report_create_date,
r.report_revised_date,r.report_root_id
FROM report r FORCE INDEX (unique_report)
JOIN `user` u
ON u.user_id = r.user_id
JOIN department d FORCE INDEX (unique_department)
ON u.department_id = d.department_id
WHERE (u.user_name LIKE CONCAT('%', 'hieu', '%'))
AND (d.department_name LIKE CONCAT('%', 'BOM', '%'))
AND r.report_id IN (
SELECT r.report_id
FROM report r FORCE INDEX (unique_report)
WHERE r.user_id =1
UNION ALL
SELECT r.report_id
FROM report r
JOIN `user` u
ON u.user_id = r.user_id
JOIN department d FORCE INDEX (unique_department)
ON u.department_id = d.department_id
JOIN authority a FORCE INDEX (unique_authority)
ON r.user_id = a.user_src_id
WHERE a.user_dest_id =1)
AND (r.report_id IN (
SELECT r.report_id
FROM report r FORCE INDEX (unique_report)
WHERE r.report_comment LIKE CONCAT('%', 'this', '%'))
OR r.report_id IN (
SELECT report_id
FROM report_content FORCE INDEX (unique_report_content)
WHERE visited_company LIKE CONCAT('%', 'this', '%')
UNION
SELECT report_id
FROM report_content FORCE INDEX (unique_report_content)
WHERE report_description LIKE CONCAT('%', 'this', '%')))
ORDER BY r.report_target_date DESC
LIMIT 0, 30