18 duplicated queries found.
Time | Duration | Type | Duplicated | Query |
---|---|---|---|---|
23:18:45.276 | 0.9 ms | SELECT | 1 | select * from kpi_hdc k
left join kpi_template i on i.id=k.kpi_template_id
left join kpi_template_to_year y on y.kpi_template_id=k.kpi_template_id
where y.year='2019' and k.kpi_template_id='30' |
23:18:45.277 | 192.0 ms | SELECT | 1 | SELECT IF(X.areacode!="TOTAL",areaname,"รวมทั้งหมด")as areaname_new, X.*
FROM (SELECT IFNULL(concat(C.tamboncodefull),"TOTAL") as areacode, C.tambonname as areaname,
MAX(K.date_com) AS report_date,
-- chart column & gauge
SUM(K.target) as target,
SUM(K.result2) as result,
ROUND(SUM(IFNULL(K.result1,0))/SUM(IFNULL(K.target,0))*100,2) as total_ratio,
-- totalOFyear
SUM(K.target) as targetAll_B1HDC,
SUM(K.result1) as result1_B2HDC,
ROUND(SUM(IFNULL(K.result1,0))/SUM(IFNULL(K.target,0))*100,2) as B2B1HDC_ratio,
SUM(K.result2) as result2_A1HDC,
ROUND(SUM(IFNULL(K.result2,0))/SUM(IFNULL(K.result1,0))*100,2) as A1B2HDC_ratio,
SUM(K.result3) as result3_height_male,
SUM(K.result5) as result5_sumheight_male,
ROUND(SUM(IFNULL(K.result5,0))/SUM(IFNULL(K.result3,0)),2) as heightmale_ratio,
SUM(K.result4) as result4_height_female,
SUM(K.result6) as result6_sumheight_female,
ROUND(SUM(IFNULL(K.result6,0))/SUM(IFNULL(K.result4,0)),2) as heightfemale_ratio,
-- Quarter1
SUM(K.targetq1) as targetq1,
ROUND(SUM(IFNULL(K.targetq1,0))/SUM(IFNULL(K.target,0))*100,2) as target_ratio_q1,
SUM(K.resultq1) as resultq1,
ROUND(SUM(IFNULL(K.resultq1,0))/SUM(IFNULL(K.targetq1,0))*100,2) as result_ratio_q1,
SUM(K.b2q1) as male_height_q1,
SUM(K.a2q1) as sum_male_height_q1,
ROUND(SUM(IFNULL(K.a2q1,0))/SUM(IFNULL(K.b2q1,0)),2) as heightmale_ratio_q1,
SUM(K.b3q1) as female_height_q1,
SUM(K.a3q1) as sum_female_height_q1,
ROUND(SUM(IFNULL(K.a3q1,0))/SUM(IFNULL(K.b3q1,0)),2) as heightfemale_ratio_q1,
-- Quarter2
SUM(K.targetq2) as targetq2,
ROUND(SUM(IFNULL(K.targetq2,0))/SUM(IFNULL(K.target,0))*100,2) as target_ratio_q2,
SUM(K.resultq2) as resultq2,
ROUND(SUM(IFNULL(K.resultq2,0))/SUM(IFNULL(K.targetq2,0))*100,2) as result_ratio_q2,
SUM(K.b2q2) as male_height_q2,
SUM(K.a2q2) as sum_male_height_q2,
ROUND(SUM(IFNULL(K.a2q2,0))/SUM(IFNULL(K.b2q2,0)),2) as heightmale_ratio_q2,
SUM(K.b3q2) as female_height_q2,
SUM(K.a3q2) as sum_female_height_q2,
ROUND(SUM(IFNULL(K.a3q2,0))/SUM(IFNULL(K.b3q2,0)),2) as heightfemale_ratio_q2,
-- Quarter3
SUM(K.targetq3) as targetq3,
ROUND(SUM(IFNULL(K.targetq3,0))/SUM(IFNULL(K.target,0))*100,2) as target_ratio_q3,
SUM(K.resultq3) as resultq3,
ROUND(SUM(IFNULL(K.resultq3,0))/SUM(IFNULL(K.targetq3,0))*100,2) as result_ratio_q3,
SUM(K.b2q3) as male_height_q3,
SUM(K.a2q3) as sum_male_height_q3,
ROUND(SUM(IFNULL(K.a2q3,0))/SUM(IFNULL(K.b2q3,0)),2) as heightmale_ratio_q3,
SUM(K.b3q3) as female_height_q3,
SUM(K.a3q3) as sum_female_height_q3,
ROUND(SUM(IFNULL(K.a3q3,0))/SUM(IFNULL(K.b3q3,0)),2) as heightfemale_ratio_q3,
-- Quarter3
SUM(K.targetq4) as targetq4,
ROUND(SUM(IFNULL(K.targetq4,0))/SUM(IFNULL(K.target,0))*100,2) as target_ratio_q4,
SUM(K.resultq4) as resultq4,
ROUND(SUM(IFNULL(K.resultq4,0))/SUM(IFNULL(K.targetq4,0))*100,2) as result_ratio_q4,
SUM(K.b2q4) as male_height_q4,
SUM(K.a2q4) as sum_male_height_q4,
ROUND(SUM(IFNULL(K.a2q4,0))/SUM(IFNULL(K.b2q4,0)),2) as heightmale_ratio_q4,
SUM(K.b3q4) as female_height_q4,
SUM(K.a3q4) as sum_female_height_q4,
ROUND(SUM(IFNULL(K.a3q4,0))/SUM(IFNULL(K.b3q4,0)),2) as heightfemale_ratio_q4
FROM s_kpi_height05 K
INNER JOIN ctambon C ON C.tamboncodefull=LEFT(K.areacode,6)
WHERE K.id = '67e41dbb1ce5d844d49f6b7b10e30d01'
AND K.b_year = 2562
AND C.ampurcode = '7304'
GROUP BY C.tamboncodefull
WITH ROLLUP) X |
23:18:45.470 | 0.5 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '56.16') AND (`range_max` >= '56.16') |
23:18:45.470 | 1.6 ms | SHOW | 1 | SHOW FULL COLUMNS FROM `kpi_range` |
23:18:45.472 | 1.1 ms | SELECT | 1 | SELECT
kcu.constraint_name,
kcu.column_name,
kcu.referenced_table_name,
kcu.referenced_column_name
FROM information_schema.referential_constraints AS rc
JOIN information_schema.key_column_usage AS kcu ON
(
kcu.constraint_catalog = rc.constraint_catalog OR
(kcu.constraint_catalog IS NULL AND rc.constraint_catalog IS NULL)
) AND
kcu.constraint_schema = rc.constraint_schema AND
kcu.constraint_name = rc.constraint_name
WHERE rc.constraint_schema = database() AND kcu.table_schema = database()
AND rc.table_name = 'kpi_range' AND kcu.table_name = 'kpi_range' |
23:18:45.474 | 0.3 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '56.16') AND (`range_max` >= '56.16') |
23:18:45.474 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '55.46') AND (`range_max` >= '55.46') |
23:18:45.475 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '55.46') AND (`range_max` >= '55.46') |
23:18:45.475 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '48.90') AND (`range_max` >= '48.90') |
23:18:45.475 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '48.90') AND (`range_max` >= '48.90') |
23:18:45.476 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '50.77') AND (`range_max` >= '50.77') |
23:18:45.476 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '50.77') AND (`range_max` >= '50.77') |
23:18:45.476 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '41.33') AND (`range_max` >= '41.33') |
23:18:45.476 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '41.33') AND (`range_max` >= '41.33') |
23:18:45.477 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '56.19') AND (`range_max` >= '56.19') |
23:18:45.477 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '56.19') AND (`range_max` >= '56.19') |
23:18:45.477 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '38.60') AND (`range_max` >= '38.60') |
23:18:45.478 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '38.60') AND (`range_max` >= '38.60') |
23:18:45.478 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '33.33') AND (`range_max` >= '33.33') |
23:18:45.478 | 0.2 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '33.33') AND (`range_max` >= '33.33') |
23:18:45.478 | 0.2 ms | SELECT | 1 | SELECT * FROM `kpi_range` WHERE (kpi_template_id='30') AND (year = 2562) AND (`range_min` <= '51.05') AND (`range_max` >= '51.05') |
23:18:45.479 | 5.2 ms | SELECT | 1 | select * from geojson_tambon g
inner join ctambon t on t.tamboncodefull=g.areacode
where ampurcode='7304' |
23:18:45.486 | 384.4 ms | SELECT | 1 | SELECT K.b_year,
ROUND(SUM(IFNULL(K.result2,0))/SUM(IFNULL(K.result1,0))*100,2) as total_ratio,
-- Quarter1
ROUND(SUM(IFNULL(K.resultq1,0))/SUM(IFNULL(K.targetq1,0))*100,2) as result_ratio_q1,
-- Quarter2
ROUND(SUM(IFNULL(K.resultq2,0))/SUM(IFNULL(K.targetq2,0))*100,2) as result_ratio_q2,
-- Quarter3
ROUND(SUM(IFNULL(K.resultq3,0))/SUM(IFNULL(K.targetq3,0))*100,2) as result_ratio_q3,
-- Quarter4
ROUND(SUM(IFNULL(K.resultq4,0))/SUM(IFNULL(K.targetq4,0))*100,2) as result_ratio_q4
FROM s_kpi_height05 K
INNER JOIN ctambon C ON C.tamboncodefull=LEFT(K.areacode,6)
WHERE K.id = '67e41dbb1ce5d844d49f6b7b10e30d01'
AND K.b_year BETWEEN 2558 and 2568
AND C.ampurcode = '7304'
group by K.b_year |
23:18:45.871 | 0.4 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id = '30') AND (year = 2562) |
23:18:45.872 | 0.3 ms | SELECT | 2 | SELECT * FROM `kpi_range` WHERE (kpi_template_id = '30') AND (year = 2562) |
23:18:45.872 | 2.6 ms | SELECT | 1 | select changwatcode from ctambon where ampurcode='7304' |
23:18:45.875 | 0.2 ms | SELECT | 1 | select regioncode from cchangwat where changwatcode='73' |
23:18:45.878 | 0.2 ms | SELECT | 1 | SELECT `data` FROM `session` WHERE `expire`>1754324325 AND `id`='od2pu513lc730hsij0tuj50gql' |
23:18:45.880 | 1.1 ms | SHOW | 1 | SHOW FULL COLUMNS FROM `session` |
23:18:45.881 | 1.0 ms | SELECT | 1 | SELECT
kcu.constraint_name,
kcu.column_name,
kcu.referenced_table_name,
kcu.referenced_column_name
FROM information_schema.referential_constraints AS rc
JOIN information_schema.key_column_usage AS kcu ON
(
kcu.constraint_catalog = rc.constraint_catalog OR
(kcu.constraint_catalog IS NULL AND rc.constraint_catalog IS NULL)
) AND
kcu.constraint_schema = rc.constraint_schema AND
kcu.constraint_name = rc.constraint_name
WHERE rc.constraint_schema = database() AND kcu.table_schema = database()
AND rc.table_name = 'session' AND kcu.table_name = 'session' |
23:18:45.882 | 2.7 ms | SELECT | 1 | SELECT
`kcu`.`CONSTRAINT_NAME` AS `name`,
`kcu`.`COLUMN_NAME` AS `column_name`,
`tc`.`CONSTRAINT_TYPE` AS `type`,
CASE
WHEN NULL IS NULL AND `kcu`.`REFERENCED_TABLE_SCHEMA` = DATABASE() THEN NULL
ELSE `kcu`.`REFERENCED_TABLE_SCHEMA`
END AS `foreign_table_schema`,
`kcu`.`REFERENCED_TABLE_NAME` AS `foreign_table_name`,
`kcu`.`REFERENCED_COLUMN_NAME` AS `foreign_column_name`,
`rc`.`UPDATE_RULE` AS `on_update`,
`rc`.`DELETE_RULE` AS `on_delete`,
`kcu`.`ORDINAL_POSITION` AS `position`
FROM
`information_schema`.`KEY_COLUMN_USAGE` AS `kcu`,
`information_schema`.`REFERENTIAL_CONSTRAINTS` AS `rc`,
`information_schema`.`TABLE_CONSTRAINTS` AS `tc`
WHERE
`kcu`.`TABLE_SCHEMA` = COALESCE(NULL, DATABASE()) AND `kcu`.`CONSTRAINT_SCHEMA` = `kcu`.`TABLE_SCHEMA` AND `kcu`.`TABLE_NAME` = 'session'
AND `rc`.`CONSTRAINT_SCHEMA` = `kcu`.`TABLE_SCHEMA` AND `rc`.`TABLE_NAME` = 'session' AND `rc`.`CONSTRAINT_NAME` = `kcu`.`CONSTRAINT_NAME`
AND `tc`.`TABLE_SCHEMA` = `kcu`.`TABLE_SCHEMA` AND `tc`.`TABLE_NAME` = 'session' AND `tc`.`CONSTRAINT_NAME` = `kcu`.`CONSTRAINT_NAME` AND `tc`.`CONSTRAINT_TYPE` = 'FOREIGN KEY'
UNION
SELECT
`kcu`.`CONSTRAINT_NAME` AS `name`,
`kcu`.`COLUMN_NAME` AS `column_name`,
`tc`.`CONSTRAINT_TYPE` AS `type`,
NULL AS `foreign_table_schema`,
NULL AS `foreign_table_name`,
NULL AS `foreign_column_name`,
NULL AS `on_update`,
NULL AS `on_delete`,
`kcu`.`ORDINAL_POSITION` AS `position`
FROM
`information_schema`.`KEY_COLUMN_USAGE` AS `kcu`,
`information_schema`.`TABLE_CONSTRAINTS` AS `tc`
WHERE
`kcu`.`TABLE_SCHEMA` = COALESCE(NULL, DATABASE()) AND `kcu`.`TABLE_NAME` = 'session'
AND `tc`.`TABLE_SCHEMA` = `kcu`.`TABLE_SCHEMA` AND `tc`.`TABLE_NAME` = 'session' AND `tc`.`CONSTRAINT_NAME` = `kcu`.`CONSTRAINT_NAME` AND `tc`.`CONSTRAINT_TYPE` IN ('PRIMARY KEY', 'UNIQUE')
ORDER BY `position` ASC |
23:18:45.885 | 0.8 ms | SELECT | 1 | SELECT
`s`.`INDEX_NAME` AS `name`,
`s`.`COLUMN_NAME` AS `column_name`,
`s`.`NON_UNIQUE` ^ 1 AS `index_is_unique`,
`s`.`INDEX_NAME` = 'PRIMARY' AS `index_is_primary`
FROM `information_schema`.`STATISTICS` AS `s`
WHERE `s`.`TABLE_SCHEMA` = COALESCE(NULL, DATABASE()) AND `s`.`INDEX_SCHEMA` = `s`.`TABLE_SCHEMA` AND `s`.`TABLE_NAME` = 'session'
ORDER BY `s`.`SEQ_IN_INDEX` ASC |
23:18:45.886 | 10.3 ms | INSERT | 1 | INSERT INTO `session` (`data`, `id`, `expire`) VALUES ('__flash|a:0:{}', 'od2pu513lc730hsij0tuj50gql', 1754325765) ON DUPLICATE KEY UPDATE `data`=VALUES(`data`), `expire`=VALUES(`expire`) |