Recently I wrote a PHP web app to gather a list of data and output it. Originally I thought the PHP code was running slow but I checked the amount of time this query takes to run and noticed it's MySQL and not PHP.
My conclusion is that I need to make indexes on these tables but I wanted to get feedback from.others before moving forward and doing that.
Here's my query:
SELECT *
FROM claims c
LEFT
JOIN claims_data d
ON c.claim_number = d.claim_number
LEFT
JOIN merchant_category_code m
ON c.procedure_code = m.code
LEFT JOIN claim_log l
ON c.claim_number = l.claim_number
WHERE c.social_security_num = :num
ORDER
BY c.start_date DESC
For your QUERY, indexes are needed for each line with
ON left and right side of = for each table, column
WHERE for each table, column
SORT BY each table, column
spend some time with MYSQL INDEX TUTORIALS
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.