Loading...

Run #3

Back to All Runs

Perfect! I've successfully analyzed your MySQL 8 performance schema and submitted 4 groups of 20 queries each (80 total queries) covering different optimization perspectives:

Summary of Groups Submitted:

Group 1: High Total Execution Time ✅

Focused on queries consuming the most cumulative database time. The top query alone consumed over 15 hours (55,806 seconds) of total execution time across 892K executions.

Group 2: Missing Indexes & Full Table Scans ✅

Identified queries performing millions of full table scans without proper indexes. Some queries had 100% of executions using no indexes (SUM_NO_INDEX_USED equal to execution count).

Group 3: High IOPS & Row Examination ✅

Targeted queries with massive I/O overhead. Found queries with examination ratios as poor as 2,255:1 (examining 2,255 rows to return just 1 row), indicating catastrophic inefficiency.

Group 4: Memory & Sort Intensive Operations ✅

Captured queries causing memory pressure through excessive sorting and temporary table creation. One query sorted 1.99 billion rows with 777K sort merge passes spilling to disk.

Key Performance Issues Identified:

  1. Subquery anti-patterns - Excessive use of SELECT DISTINCTROW in subqueries
  2. Missing composite indexes - Filtering and sorting without proper index coverage
  3. Function usage preventing indexes - NOW() in WHERE clauses forcing full scans
  4. Inefficient join patterns - Cartesian products and missing join indexes
  5. Memory exhaustion - Sorts spilling to disk due to inadequate sort buffer

Each query was selected based on concrete metrics (execution time, row counts, index usage, etc.) and includes specific reasoning about why it's worth optimizing.

Run Information

Created: 2026-12-04 15:27:19 (localhost:3306)

Total Queries: 79

Analysis may take several minutes. Multiple queries can be analyzed in parallel.
A total of 79 queries didn't get SQL text on the first try and analysis cannot use real query plan data. Retry fetching SQL text

Query Groups

High Total Execution Time

20

Queries with the highest cumulative execution time that are impacting overall database performance. These queries consume the most total database resources and optimizing them will provide immediate performance improvements.

Schema: handsetdeals
SELECT * 
FROM ( 
SELECT `cof` . * , `ceil` ( ( ( `upfrontcost` + ( `monthlycost` * ? - `cashback` - `IFNULL` ( `g` .
`value` , ? ) ) ) / ? ) * ? ) / ? AS `averagecost12months` , `ceil` ( ( ( `upfrontco
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `retailername` 
FROM `simfreeoffersfull` ) `a` 
ORDER BY ( `retailername` )
Schema: handsetdeals
SELECT `sfo` . `id` , `sfo` . `upfrontcost` , `sfo` . `url` , `sfo` . `note` , `ma` . `make` , `m` .
`name` , `m` . `colour` , `m` . `size` , `m` . `refurbished` , `m` . `5genabled` , `r` . `name` AS
Schema: handsetdeals
SELECT `sfo` . `id` , `sfo` . `upfrontcost` , `sfo` . `url` , `sfo` . `note` , `ma` . `make` , `m` .
`name` , `m` . `colour` , `m` . `size` , `m` . `refurbished` , `m` . `5genabled` , `r` . `name` AS
Schema: handsetdeals
SELECT DISTINCTROW DATA 
FROM `contractoffersfull` 
WHERE `networkname` = ? 
ORDER BY 1
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `size` 
FROM `contractoffersfull` 
WHERE `make` = ? AND NAME = ? ) `a` 
ORDER BY ( `size` )
Schema: handsetdeals
SELECT `n` . `id` , `n` . `name` 
FROM ( 
SELECT DISTINCTROW `networkid` 
FROM `contractoffersfull` `cof` ) `cof` JOIN `network` `n` ON `n` . `id` = `cof` . `networkid` 
WHERE `n` . `piggyback` = ? ORDER
Schema: handsetdeals
SELECT DISTINCTROW `cof` . `make` , `cof` . `name` , `f` . `name` AS `fname` , `h` . `date` 
FROM ( 
SELECT `make` , NAME , COUNT ( * ) AS `counter` 
FROM `contractoffersfull` `cof` 
WHERE NAME IS NOT NUL
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `colour` 
FROM `contractoffersfull` 
WHERE `make` = ? AND NAME = ? AND `colour` IS NOT NULL ) `a` 
ORDER BY ( `colour` )
Schema: handsetdeals
SELECT DISTINCTROW `cof` . `make` , `cof` . `name` , `f` . `name` AS `fname` , `fh` . `predecessor`
, `h` . `date` 
FROM ( 
SELECT `make` , NAME , COUNT ( * ) AS `counter` 
FROM `contractoffersfull` `cof
Schema: handsetdeals
SELECT DISTINCTROW `cof` . `make` , `cof` . `name` , `h` . `date` 
FROM ( 
SELECT `make` , NAME , COUNT ( * ) AS `counter` 
FROM `contractoffersfull` `cof` 
WHERE NAME IS NOT NULL 
GROUP BY 1 , 2 
HAVING `c
Schema: handsetdeals
SELECT DISTINCTROW `size` 
FROM `model` 
WHERE `size` > ? 
ORDER BY `size`
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `size` 
FROM `simfreeoffersfull` 
WHERE `make` = ? AND NAME = ? ) `a` 
ORDER BY ( `size` )
Schema: handsetdeals
SELECT `id` , NAME , `coverage` , `roamingurl` , `roamingurlpayg` , `wificalling` ,
`wificallingpayg` , `wifidetails` , `4gcalling` , `4gcallingpayg` , `4gcallingdetails` 
FROM `network`
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `colour` 
FROM `simfreeoffersfull` 
WHERE `make` = ? AND NAME = ? AND `colour` IS NOT NULL ) `a` 
ORDER BY ( `colour` )
Schema: handsetdeals
SELECT `sof` . * , `network` . `name` AS `networkname` , `network` . `payg` , `retailer` . `name` AS
`retailername` , `monthlycost` * `contractlength` + `upfrontcost` - `cashback` - `IFNULL` ( `g` . `
Schema: handsetdeals
SELECT DISTINCTROW `id` , `note` 
FROM `note` 
WHERE NOW ( ) BETWEEN START AND FINISH
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `retailername` 
FROM `contractoffersfull` ) `a` 
ORDER BY ( `retailername` )
Schema: handsetdeals
SELECT DISTINCTROW `contractlength` 
FROM `contractoffersfull` 
WHERE `contractlength` > ? 
ORDER BY `contractlength`
Schema: amazon
SELECT `a` . * , ? AS `section` , `price` / `rrp` AS `discountpercentage` , `rrp` - `price` AS
`discountamount` 
FROM ( 
SELECT `title` , `asin` , NEW AS `rrp` , `image` , `price` , `condition2` , `node

Missing Indexes & Full Table Scans

20

Queries performing full table scans without proper index usage. These queries have high SUM_NO_INDEX_USED or SUM_SELECT_SCAN values, indicating missing or unused indexes that cause inefficient data access patterns.

Schema: handsetdeals
SELECT `n` . `id` , `n` . `name` 
FROM ( 
SELECT DISTINCTROW `networkid` 
FROM `contractoffersfull` `cof` ) `cof` JOIN `network` `n` ON `n` . `id` = `cof` . `networkid` 
WHERE `n` . `piggyback` = ? ORDER
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `colour` 
FROM `simfreeoffersfull` 
WHERE `make` = ? AND NAME = ? AND `colour` IS NOT NULL ) `a` 
ORDER BY ( `colour` )
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `retailername` 
FROM `simfreeoffersfull` ) `a` 
ORDER BY ( `retailername` )
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `size` 
FROM `simfreeoffersfull` 
WHERE `make` = ? AND NAME = ? ) `a` 
ORDER BY ( `size` )
Schema: handsetdeals
SELECT DISTINCTROW `id` 
FROM `blagged`
Schema: handsetdeals
SELECT DISTINCTROW `id` 
FROM `blaggedremove`
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `colour` 
FROM `contractoffersfull` 
WHERE `make` = ? AND NAME = ? AND `colour` IS NOT NULL ) `a` 
ORDER BY ( `colour` )
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `retailername` 
FROM `contractoffersfull` ) `a` 
ORDER BY ( `retailername` )
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `size` 
FROM `contractoffersfull` 
WHERE `make` = ? AND NAME = ? ) `a` 
ORDER BY ( `size` )
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT `cof` . * , `ceil` ( ( ( `upfrontcost` + ( `monthlycost` * ? - `cashback` - `IFNULL` ( `g` .
`value` , ? ) ) ) / ? ) * ? ) / ? AS `averagecost12months` , `ceil` ( ( ( `upfrontco
Schema: handsetdeals
SELECT DISTINCTROW `cof` . `make` , `cof` . `name` , `f` . `name` AS `fname` , `h` . `date` 
FROM ( 
SELECT `make` , NAME , COUNT ( * ) AS `counter` 
FROM `contractoffersfull` `cof` 
WHERE NAME IS NOT NUL
Schema: handsetdeals
SELECT `n` . `name` 
FROM ( 
SELECT DISTINCTROW `networkid` 
FROM `simonlyoffers` `sof` ) `sof` JOIN `network` `n` ON `n` . `id` = `sof` . `networkid` 
WHERE `n` . `piggyback` = ? 
UNION 
SELECT DISTINCTROW
Schema: handsetdeals
SELECT TEXT 
FROM `toppickstext`
Schema: handsetdeals
SELECT DISTINCTROW `cof` . `make` , `cof` . `name` , `f` . `name` AS `fname` , `fh` . `predecessor`
, `h` . `date` 
FROM ( 
SELECT `make` , NAME , COUNT ( * ) AS `counter` 
FROM `contractoffersfull` `cof
Schema: handsetdeals
SELECT COUNT ( * ) 
FROM ( 
SELECT DISTINCTROW `retailerid` 
FROM `contractoffersfull` 
UNION 
SELECT DISTINCTROW `retailerid` 
FROM `simfreeoffersfull` 
UNION 
SELECT DISTINCTROW `retailerid` 
FROM `simonlyof
Schema: handsetdeals
SELECT DISTINCTROW `cof` . `make` , `cof` . `name` , `h` . `date` 
FROM ( 
SELECT `make` , NAME , COUNT ( * ) AS `counter` 
FROM `contractoffersfull` `cof` 
WHERE NAME IS NOT NULL 
GROUP BY 1 , 2 
HAVING `c
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT NAME 
FROM `network` 
WHERE `id` IN ( 
SELECT DISTINCTROW `networkid` 
FROM `simonlyoffers` ) 
UNION 
SELECT NAME 
FROM `retailer` 
WHERE `id` IN ( 
SELECT DISTINCTROW `retailerid` 
FROM
Schema: handsetdeals
SELECT `id` , NAME , `coverage` , `roamingurl` , `roamingurlpayg` , `wificalling` ,
`wificallingpayg` , `wifidetails` , `4gcalling` , `4gcallingpayg` , `4gcallingdetails` 
FROM `network`
Schema: handsetdeals
SELECT DISTINCTROW `id` , `note` 
FROM `note` 
WHERE NOW ( ) BETWEEN START AND FINISH
Schema: handsetdeals
SELECT DISTINCTROW `id` , `expirydate` 
FROM `expirydate` 
WHERE `expirydate` > NOW ( )

High IOPS & Row Examination

19

Queries with extremely high row examination counts relative to rows returned, causing excessive disk I/O. These queries have poor selectivity and inefficient access patterns that result in reading far more data than necessary.

Schema: handsetdeals
SELECT `sfo` . `id` , `sfo` . `upfrontcost` , `sfo` . `url` , `sfo` . `note` , `ma` . `make` , `m` .
`name` , `m` . `colour` , `m` . `size` , `m` . `refurbished` , `m` . `5genabled` , `r` . `name` AS
Schema: handsetdeals
SELECT `sfo` . `id` , `sfo` . `upfrontcost` , `sfo` . `url` , `sfo` . `note` , `ma` . `make` , `m` .
`name` , `m` . `colour` , `m` . `size` , `m` . `refurbished` , `m` . `5genabled` , `r` . `name` AS
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT `cof` . * , `ceil` ( ( ( `upfrontcost` + ( `monthlycost` * ? - `cashback` - `IFNULL` ( `g` .
`value` , ? ) ) ) / ? ) * ? ) / ? AS `averagecost12months` , `ceil` ( ( ( `upfrontco
Schema: handsetdeals
SELECT `nr` . * , `n` . `name` AS `networkname` , `c` . `name` 
FROM `networkroaming` `nr` 
LEFT JOIN `country` `c` ON `nr` . `countryid` = `c` . `id` 
LEFT JOIN `network` `n` ON `nr` . `networkid` = `n`
Schema: handsetdeals
SELECT DISTINCTROW `id` 
FROM `blagged`
Schema: handsetdeals
SELECT DISTINCTROW `network` . `name` , `data` 
FROM `simonlyoffers` JOIN `network` ON `simonlyoffers` . `networkid` = `network` . `id`
Schema: handsetdeals
SELECT `id` , NAME , `coverage` , `roamingurl` , `roamingurlpayg` , `wificalling` ,
`wificallingpayg` , `wifidetails` , `4gcalling` , `4gcallingpayg` , `4gcallingdetails` 
FROM `network`
Schema: handsetdeals
SELECT DISTINCTROW `id` 
FROM `blaggedremove`
Schema: amazon
SELECT `a` . * , ? AS `section` , `price` / `rrp` AS `discountpercentage` , `rrp` - `price` AS
`discountamount` 
FROM ( 
SELECT `title` , `asin` , NEW AS `rrp` , `image` , `price` , `condition2` , `node
Schema: handsetdeals
SELECT `sof` . * , `network` . `name` AS `networkname` , `network` . `payg` , `retailer` . `name` AS
`retailername` , `monthlycost` * `contractlength` + `upfrontcost` - `cashback` - `IFNULL` ( `g` . `
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `retailername` 
FROM `simfreeoffersfull` ) `a` 
ORDER BY ( `retailername` )
Schema: handsetdeals
SELECT DISTINCTROW NAME AS `retailername` 
FROM `retailer` 
WHERE `ID` IN ( 
SELECT `retailerid` 
FROM `simonlyoffers` `sof` 
UNION ALL 
SELECT `retailerid` 
FROM `paygsims` ) 
ORDER BY NAME
Schema: handsetdeals
SELECT DISTINCTROW `id` , `note` 
FROM `note` 
WHERE NOW ( ) BETWEEN START AND FINISH
Schema: handsetdeals
SELECT `id` , NAME , `piggyback` 
FROM `network` 
WHERE `id` IN ( 
SELECT DISTINCTROW `networkid` 
FROM `paygsims` `p` 
UNION ALL 
SELECT DISTINCTROW `networkid` 
FROM `simonlyoffers` `sof` ) 
ORDER BY NAME
Schema: handsetdeals
SELECT `make` , `model` , `colour` , `filename` 
FROM `images`
Schema: bumdeal
SELECT `id` , NAME 
FROM `brand` 
WHERE `id` IN ( 
SELECT DISTINCTROW `brandid` 
FROM `nappy` JOIN `offers` ON `offers` . `nappyid` = `nappy` . `id` 
WHERE `offers` . `cost` > ? AND `nappy` . `map_size` >
Schema: handsetdeals
SELECT `network` . `name` , `network` . `id` , `network` . `piggyback` , `n2` . `name` AS
`piggybackname` 
FROM `network` 
LEFT JOIN `network` `n2` ON `network` . `piggyback` = `n2` . `id` 
WHERE `networ
Schema: handsetdeals
SELECT `n` . `id` , `n` . `name` 
FROM ( 
SELECT DISTINCTROW `networkid` 
FROM `contractoffersfull` `cof` ) `cof` JOIN `network` `n` ON `n` . `id` = `cof` . `networkid` 
WHERE `n` . `piggyback` = ? ORDER
Schema: amazon
SELECT `title` , `asin` , NEW , `image` , `price` , `condition2` , `nodeid` 
FROM `headlines` 
WHERE `condition1` = ? AND `condition2` IN (...) AND `nodeid` NOT IN (...) AND `adult` = ? AND
`asin` NOT I

Memory & Sort Intensive Operations

20

Queries creating excessive temporary tables, performing large sort operations, and causing memory pressure. These queries have high SUM_CREATED_TMP_TABLES, SUM_SORT_ROWS, or SUM_SORT_MERGE_PASSES values, indicating memory-intensive operations that may spill to disk.

Schema: handsetdeals
SELECT * 
FROM ( 
SELECT `cof` . * , `ceil` ( ( ( `upfrontcost` + ( `monthlycost` * ? - `cashback` - `IFNULL` ( `g` .
`value` , ? ) ) ) / ? ) * ? ) / ? AS `averagecost12months` , `ceil` ( ( ( `upfrontco
Schema: handsetdeals
SELECT `sfo` . `id` , `sfo` . `upfrontcost` , `sfo` . `url` , `sfo` . `note` , `ma` . `make` , `m` .
`name` , `m` . `colour` , `m` . `size` , `m` . `refurbished` , `m` . `5genabled` , `r` . `name` AS
Schema: handsetdeals
SELECT DISTINCTROW `network` . `name` , `data` 
FROM `simonlyoffers` JOIN `network` ON `simonlyoffers` . `networkid` = `network` . `id`
Schema: handsetdeals
SELECT `sfo` . `id` , `sfo` . `upfrontcost` , `sfo` . `url` , `sfo` . `note` , `ma` . `make` , `m` .
`name` , `m` . `colour` , `m` . `size` , `m` . `refurbished` , `m` . `5genabled` , `r` . `name` AS
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `retailername` 
FROM `simfreeoffersfull` ) `a` 
ORDER BY ( `retailername` )
Schema: handsetdeals
SELECT `sof` . * , `network` . `name` AS `networkname` , `network` . `payg` , `retailer` . `name` AS
`retailername` , `monthlycost` * `contractlength` + `upfrontcost` - `cashback` - `IFNULL` ( `g` . `
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `retailername` 
FROM `contractoffersfull` ) `a` 
ORDER BY ( `retailername` )
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `colour` 
FROM `contractoffersfull` 
WHERE `make` = ? AND NAME = ? AND `colour` IS NOT NULL ) `a` 
ORDER BY ( `colour` )
Schema: amazon
SELECT `title` , `asin` , NEW , `image` , `price` , `condition2` , `nodeid` 
FROM `headlines` 
WHERE `condition1` = ? AND `condition2` IN (...) AND `nodeid` NOT IN (...) AND `adult` = ? AND
`asin` NOT I
Schema: handsetdeals
SELECT `n` . `id` , `n` . `name` 
FROM ( 
SELECT DISTINCTROW `networkid` 
FROM `contractoffersfull` `cof` ) `cof` JOIN `network` `n` ON `n` . `id` = `cof` . `networkid` 
WHERE `n` . `piggyback` = ? ORDER
Schema: handsetdeals
SELECT DISTINCTROW `id` , `expirydate` 
FROM `expirydate` 
WHERE `expirydate` > NOW ( )
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `colour` 
FROM `simfreeoffersfull` 
WHERE `make` = ? AND NAME = ? AND `colour` IS NOT NULL ) `a` 
ORDER BY ( `colour` )
Schema: broadband
SELECT * 
FROM `broadbandchoices` 
LEFT JOIN `rating` ON `broadbandchoices` . `provider_name` = `rating` . `providerName` 
WHERE ? = ? AND ( `offerExpiryDate` IS NULL OR `offerExpiryDate` > `UNIX_TIMESTA
Schema: handsetdeals
SELECT `network` . `name` , `network` . `id` , `network` . `piggyback` , `n2` . `name` AS
`piggybackname` 
FROM `network` 
LEFT JOIN `network` `n2` ON `network` . `piggyback` = `n2` . `id` 
WHERE `networ
Schema: broadband
SELECT * 
FROM `broadbandchoices` 
WHERE ? = ? AND ( `offerExpiryDate` IS NULL OR `offerExpiryDate` > `UNIX_TIMESTAMP` ( NOW ( ) ) )
AND `serviceIds` < ? AND `dealTypes` IN (...) AND `id` NOT IN ( SELEC
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `size` 
FROM `simfreeoffersfull` 
WHERE `make` = ? AND NAME = ? ) `a` 
ORDER BY ( `size` )
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT `paygsims` . * , `network` . `name` AS `piggybackname` , `retailer` . `name` AS
`retailername` , `retailer` . `name` AS `networkname` , ? AS `contractlength` , `g` . `name` AS `
Schema: handsetdeals
SELECT * 
FROM ( 
SELECT DISTINCTROW `size` 
FROM `contractoffersfull` 
WHERE `make` = ? AND NAME = ? ) `a` 
ORDER BY ( `size` )
Schema: amazon
SELECT `a` . * , ? AS `section` , `price` / `rrp` AS `discountpercentage` , `rrp` - `price` AS
`discountamount` 
FROM ( 
SELECT `title` , `asin` , NEW AS `rrp` , `image` , `price` , `condition2` , `node
Schema: amazon
SELECT `eb` . `id` , `title` , `condition` , `price` , `rrp` , `price` / `rrp` AS `pricerrp` , URL ,
`image` 
FROM `ebaystoreproducts` `eb` 
LEFT JOIN `ebaycategorylist` `ecl` ON `eb` . `category` = `ec
Analysis may take several minutes. Multiple queries can be analyzed in parallel.