Bug #21109 | Reorder tables using ALTER TABLE ... ORDER BY creates huge temptables | ||
---|---|---|---|
Submitted: | 18 Jul 2006 9:03 | Modified: | 18 Aug 2006 15:24 |
Reporter: | Apachez | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 4.1.18-nt | OS: | Windows (Win2k) |
Assigned to: | CPU Architecture: | Any |
[18 Jul 2006 9:03]
Apachez
[18 Jul 2006 10:00]
Apachez
I changed the size of the BLOB to TINYBLOB in order to see how this affect the tempfiles which are being created by MySQL. The MYD is now 248 MB while the MYI is still 73.7 MB. The tempfiles are smaller but still way larger than the original files. MySQL creates two files in the c:\temp directory. One named MY2 and the other MY3 - both grows to a size of 7 805 476 778 bytes (7.26 GB). Which gives that MySQL occupies in total 15 610 953 556 bytes (14.53 GB) of tempfiles just to reorder a 248 MB table !?
[18 Jul 2006 15:24]
Valeriy Kravchuk
Thank you for a bug report. Sorry, but I was not able to repeat the behaviour described with 4.1.22-BK on Linux. I had created similar table and put some random data (without large blobs) to make it of some reasonable size: ... mysql> insert into `Tbl_Search_Vector` select rand()*1000000, rand()*2000000, ' adcdefghijklmnop' from Tbl_Search_Vector; Query OK, 524288 rows affected (7.87 sec) Records: 524288 Duplicates: 0 Warnings: 0 mysql> show table status like 'Tbl%'\G *************************** 1. row *************************** Name: Tbl_Search_Vector Engine: MyISAM Version: 9 Row_format: Dynamic Rows: 1048576 Avg_row_length: 28 Data_length: 29360128 Max_data_length: 4294967295 Index_length: 12539904 Data_free: 0 Auto_increment: NULL Create_time: 2006-07-18 16:20:30 Update_time: 2006-07-18 16:21:44 Check_time: NULL Collation: latin1_swedish_ci Checksum: NULL Create_options: Comment: 1 row in set (0.00 sec) mysql> ALTER TABLE Tbl_Search_Vector ORDER BY SearchWordId, SearchChunkId; Query OK, 1048576 rows affected (21.79 sec) Records: 1048576 Duplicates: 0 Warnings: 0 mysql> select version(); +-----------+ | version() | +-----------+ | 4.1.22 | +-----------+ 1 row in set (0.00 sec) While that ALTER TABLE were running, I checked from the other window: openxs@suse:~> ls -l dbs/4.1/var/bug21109/*.M* -rw-rw---- 1 openxs users 0 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYD -rw-rw---- 1 openxs users 1024 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYI -rw-rw---- 1 openxs users 29360128 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYD -rw-rw---- 1 openxs users 12539904 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYI openxs@suse:~> ls -l dbs/4.1/var/bug21109/*.M* -rw-rw---- 1 openxs users 3145728 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYD -rw-rw---- 1 openxs users 1024 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYI -rw-rw---- 1 openxs users 29360128 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYD -rw-rw---- 1 openxs users 12539904 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYI ... openxs@suse:~> ls -l dbs/4.1/var/bug21109/*.M* -rw-rw---- 1 openxs users 24510464 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYD -rw-rw---- 1 openxs users 7414784 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYI -rw-rw---- 1 openxs users 29360128 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYD -rw-rw---- 1 openxs users 12539904 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYI openxs@suse:~> ls -l dbs/4.1/var/bug21109/*.M* -rw-rw---- 1 openxs users 25690112 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYD -rw-rw---- 1 openxs users 7417856 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYI -rw-rw---- 1 openxs users 29360128 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYD -rw-rw---- 1 openxs users 12539904 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYI openxs@suse:~> ls -l dbs/4.1/var/bug21109/*.M* -rw-rw---- 1 openxs users 27000832 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYD -rw-rw---- 1 openxs users 7418880 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYI -rw-rw---- 1 openxs users 29360128 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYD -rw-rw---- 1 openxs users 12539904 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYI openxs@suse:~> ls -l dbs/4.1/var/bug21109/*.M* -rw-rw---- 1 openxs users 28180480 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYD -rw-rw---- 1 openxs users 7418880 2006-07-18 16:22 dbs/4.1/var/bug21109/#sql-1 fe7_1.MYI -rw-rw---- 1 openxs users 29360128 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYD -rw-rw---- 1 openxs users 12539904 2006-07-18 16:21 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYI openxs@suse:~> ls -l dbs/4.1/var/bug21109/*.M* -rw-rw---- 1 openxs users 29360128 2006-07-18 16:22 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYD -rw-rw---- 1 openxs users 10747904 2006-07-18 16:22 dbs/4.1/var/bug21109/Tbl_Se arch_Vector.MYI So, temporary table was large, but not larger than original one. Please, try to repeat with a newer version, 4.1.20 on Windows, with a test case similar to mine, and inform about the results.
[18 Aug 2006 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".