Bug #11071 | SELECT crashes MySQL server | ||
---|---|---|---|
Submitted: | 3 Jun 2005 12:59 | Modified: | 27 Jun 2005 13:27 |
Reporter: | Victoria Reznichenko | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S1 (Critical) |
Version: | 4.1 bk tree | OS: | Linux (linux) |
Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
[3 Jun 2005 12:59]
Victoria Reznichenko
[7 Jun 2005 13:03]
Evgeny Potemkin
Duplicate of bug #11088
[24 Jun 2005 18:09]
MySQL Verification Team
I tested this bug report with the latest 4.1 and got the following result: mysql> SELECT faq_stats.faq_id,m2g_1.lvl1_id,count(distinct m2g_2.lvl1_id),SUM(faq_stats.faq_hits)/count(*)*count(distinct faq_stats.faq_ date),DATE_FORMAT(DATE_ADD(faq_stats.faq_date, INTERVAL 7200 SECOND), '%Y/%m'),IFNULL(lbls.label, '< No Category >') FROM faq_stats,faqs LEFT OUTER JOIN map2faq_group m2g_1 ON m2g_1.faq_group_id = faqs.faq_group_id AND m2g_1.tbl = 14 LEFT OUTER JOIN map2faq_group m2g_2 ON m 2g_2.faq_group_id = faqs.faq_group_id AND m2g_2.tbl = 13 LEFT OUTER JOIN labels lbls ON m2g_1.lvl1_id = lbls.label_id AND lbls.tbl = 14 A ND lbls.lang_id = 1 AND lbls.fld = 1 WHERE faqs.faq_id = faq_stats.faq_id AND (m2g_1.lvl1_id IN (0,12,11,6,2,7,5,1,10,9,8,3,4) OR m2g_1.l vl1_id IS NULL) AND (faq_stats.faq_date BETWEEN '2005-04-30 22:00:00' AND '2005-05-31 21:59:59') GROUP BY m2g_1.lvl1_id,IFNULL(lbls.label , '< No Category >'),5,faq_stats.faq_id ORDER BY 2; ERROR 3 (HY000): Error writing file '/tmp/MYC9FKwM' (Errcode: 28) /tmp has 1.6G ..
[27 Jun 2005 13:27]
Evgeny Potemkin
This is not a bug, just the query requires about 4G (gigabytes) of disk space to be succefully executed. In this query grouping made over lbls.label field which is of 'text' type. Sort key length for this type will be 1K * 2M records of source data = 2G temporary storage + 2G required by filesort algorithm to sort that data. Assuming that each 'label' field value in 'labels' table has it's own unique label_id value it's possible to modify GROUP BY calues like this: "GROUP BY m2g_1.lvl1_id, IFNULL(lbls.label_id , -1), 5, faq_stats.faq_id". This modification will lower disk space requirement to only 200M and will make query perform _much_ faster.