Based on the limited informations you provided, I'll expand as good as I can the possibilities you have (if you did not already do it)
First, let's rewrite your query:
UPDATE
temp_countcalculations t
JOIN (
SELECT
COUNT(*) as insuffcounts,
CRP_RefNo as ref
FROM
testsymphony7.p_education p
WHERE
p.EducationStatusId = 6
GROUP BY
CRP_RefNo
) i ON t.crp_refno = icounts.ref
SET
t.Edu_pending = i.insuffcounts;
Good.
So, you're updating all the t.Edu_pending with i.insuffcounts, based on their reference.
There are 2 queries to optimize here.
(1):
SELECT
COUNT(*) AS insuffcounts,
CRP_RefNo as ref
FROM
testsymphony7.p_education p
WHERE
p.EducationStatusId = 6
GROUP BY
CRP_RefNo
and (2):
SELECT 1
FROM
temp_countcalculations t
JOIN ((1)) i ON t.crp_refno = icounts.ref
Optimizing (1):
- Ideal index on columns:
CRP_RefNo, EducationStatusId (composite)
- Column
testsymphony7.p_education.crp_refno NOT NULL and if possible, UNIQUE.
Optimizing (2):
- Ideal index on columns
temp_countcalculations.crp_refno
- Column
temp_countcalculations.crp_refno NOT NULL and if possible, UNIQUE.
Based on that, we might be able to go a bit further with your result of:
EXPLAIN
SELECT 1
FROM
temp_countcalculations t
JOIN (
SELECT
COUNT(*) as insuffcounts,
CRP_RefNo as ref
FROM
testsymphony7.p_education p
WHERE
p.EducationStatusId = 6
GROUP BY
CRP_RefNo
) i ON t.crp_refno = icounts.ref
SHOW CREATE TABLE temp_countcalculationsANDSHOW CREATE TABLE testsymphony7.p_education