Upon my test, what happens is that MySQL restarts itself due to OOM. - created tables using create_tables.php - run SELECT concat('Select ''', a.TABLE_SCHEMA,',',a.TABLE_NAME,',', DATA_LENGTH, ',', INDEX_LENGTH, ',', DATA_FREE, ','', count(*),', ''','', ..... query - the monitor using top, vmstat and show processlist - mysql has OOM score of -1000 # cat /proc/`pidof mysqld`/oom_score_adj -1000 - Upon start: ------------------- top: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 5307 mysql 20 0 13.6g 11g 7320 S 1.0 82.4 0:19.22 mysqld vmstat -Sm 2: procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 2007 24 383 0 0 1916 465 244 360 8 2 90 0 0 0 0 0 2007 24 383 0 0 0 0 36 56 1 0 99 0 0 0 0 0 2007 24 383 0 0 0 0 35 52 1 0 99 0 0 0 0 0 2007 24 383 0 0 0 0 39 55 1 0 99 0 0 0 0 0 2007 24 383 0 0 0 0 42 53 1 0 99 0 0 0 0 0 2007 24 383 0 0 0 0 34 50 1 0 99 0 0 free -m: total used free shared buffers cached Mem: 14782 12868 1914 0 23 365 -/+ buffers/cache: 12479 2303 Swap: 2015 0 2015 cat /proc/`pidof mysqld`/oom_score_adj -1000 sysctl vm.swappiness vm.swappiness = 1 after a while: Top: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 5307 mysql 20 0 13.9g 13g 6628 S 99.1 91.5 2:29.73 mysqld 4535 root 20 0 223m 4968 2648 S 0.0 0.0 0:00.07 mysql show processlist: +----+------+-----------+--------------------+---------+------+--------------+---------+-----------+---------------+ | id | user | host | db | command | time | state | time_ms | rows_sent | rows_examined | +----+------+-----------+--------------------+---------+------+--------------+---------+-----------+---------------+ | 1 | root | localhost | information_schema | Query | 151 | Sending data | 150846 | 0 | 0 | +----+------+-----------+--------------------+---------+------+--------------+---------+-----------+---------------+ free -m: total used free shared buffers cached Mem: 14782 14608 174 0 3 759 -/+ buffers/cache: 13845 937 Swap: 2015 0 2015 vmstat: procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 183 3 795 0 0 0 18 1011 90 99 1 0 0 0 1 0 0 183 3 795 0 0 0 0 1007 86 99 1 0 0 0 1 0 0 183 3 795 0 0 0 0 1008 80 99 1 0 0 0 show processlist: +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ | id | user | host | db | command | time | state | time_ms | rows_sent | rows_examined | +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ | 1 | root | localhost | information_schema | Query | 238 | checking permissions | 238161 | 0 | 31091 | +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ free -m: total used free shared buffers cached Mem: 14782 14651 131 0 2 86 -/+ buffers/cache: 14563 219 Swap: 2015 11 2004 show processlist: +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ | id | user | host | db | command | time | state | time_ms | rows_sent | rows_examined | +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ | 1 | root | localhost | information_schema | Query | 240 | checking permissions | 240182 | 0 | 31175 | +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ free -m: total used free shared buffers cached Mem: 14782 14650 132 0 2 74 -/+ buffers/cache: 14573 209 Swap: 2015 38 1977 top: top - 15:51:14 up 1:24, 6 users, load average: 1.67, 0.94, 0.43 Tasks: 110 total, 1 running, 109 sleeping, 0 stopped, 0 zombie Cpu(s): 56.3%us, 43.3%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st Mem: 15137652k total, 14990800k used, 146852k free, 2468k buffers Swap: 2064376k total, 1463060k used, 601316k free, 13184k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 5307 mysql 20 0 16.2g 14g 2748 S 99.3 97.2 5:21.94 mysqld vmstat -Sm 2: 1 1 0 173 2 337 0 0 610 30 1035 179 57 43 0 0 0 procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 1 0 173 2 299 0 0 174 0 1019 162 59 41 0 0 0 1 1 0 173 2 261 0 0 168 20 1027 159 62 39 0 0 0 1 1 0 173 2 223 0 0 178 0 1020 153 59 41 0 0 0 1 1 0 173 2 186 0 0 168 0 1024 155 59 41 0 1 0 1 1 0 172 2 148 0 0 420 22 1029 178 60 40 0 0 0 1 1 0 171 2 113 0 0 174 0 1018 156 59 41 0 0 0 1 1 0 141 2 104 0 0 294 18 1021 160 55 45 0 0 0 1 1 18 138 2 86 0 9 168 8976 1052 184 55 45 0 0 0 1 1 48 138 2 75 0 15 200 14426 1065 189 56 44 0 0 0 1 1 74 138 2 65 0 13 168 13164 1069 191 56 44 0 0 0 1 1 103 141 2 56 0 14 164 14110 1064 187 54 46 0 0 0 1 1 134 145 2 48 0 15 162 14972 1064 185 56 44 0 0 0 1 1 163 143 2 41 0 15 310 14398 1075 189 55 44 0 1 0 1 1 197 146 2 34 0 17 400 16202 1085 200 57 44 0 0 0 1 1 229 148 2 29 0 16 162 15792 1069 185 57 43 0 0 0 1 1 261 155 2 19 0 16 190 15892 1073 190 54 46 0 0 0 1 1 297 160 3 14 0 18 2398 17148 1143 309 52 48 0 0 0 1 1 336 161 2 12 0 20 1494 19226 1110 241 59 41 0 1 0 1 1 368 163 2 10 0 16 1984 15708 1105 261 57 44 0 0 0 1 0 392 149 2 11 0 12 516 11752 1071 178 57 43 0 0 0 1 0 457 173 3 15 0 33 5282 31884 1226 382 55 45 0 1 0 1 0 481 158 3 16 0 12 832 11584 1063 180 56 44 0 0 0 3 1 503 148 2 14 0 11 762 10898 1069 183 57 44 0 0 0 1 1 539 153 2 10 0 18 232 17324 1068 170 57 43 0 0 0 1 0 588 165 2 8 0 24 400 23826 1097 201 59 41 0 1 0 1 1 613 156 2 7 0 13 916 12550 1077 197 58 42 0 0 0 show processlist: +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ | id | user | host | db | command | time | state | time_ms | rows_sent | rows_examined | +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ | 1 | root | localhost | information_schema | Query | 310 | checking permissions | 309679 | 0 | 34004 | +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ free -m: total used free shared buffers cached Mem: 14782 14640 142 0 3 13 -/+ buffers/cache: 14623 159 Swap: 2015 1214 801 +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ | id | user | host | db | command | time | state | time_ms | rows_sent | rows_examined | +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ | 1 | root | localhost | information_schema | Query | 312 | checking permissions | 311718 | 0 | 34088 | +----+------+-----------+--------------------+---------+------+----------------------+---------+-----------+---------------+ free -m: procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- 0 1 1973 166 2 9 0 0 962 18 346 140 16 13 0 72 0 1 1 1989 156 2 6 0 8 140 7704 895 163 48 37 0 16 0 1 0 2034 157 3 13 0 23 4846 22226 1160 361 53 47 0 1 0 1 1 2063 151 2 10 0 14 272 14088 1057 187 57 43 0 0 0 1 1 2098 157 2 5 0 17 1182 16808 1102 259 56 45 0 0 0 1 1 2113 146 3 14 0 8 7864 7728 1203 449 53 47 0 0 0 5 4 2113 132 0 2 0 0 49008 40 2293 2979 49 43 0 8 0 After this, the server triggers the OOM killer. Oct 15 15:12:42 localhost kernel: mysqld invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=-17, oom_score_adj=-1000 ... Oct 15 15:12:42 localhost kernel: [ pid ] uid tgid total_vm rss cpu oom_adj oom_score_adj name Oct 15 15:12:42 localhost kernel: [ 2341] 0 2341 27063 1 0 0 0 mysqld_safe Oct 15 15:12:42 localhost kernel: [ 2760] 498 2760 4407264 3680571 0 -17 -1000 mysqld # mysqld --version mysqld Ver 5.6.19-67.0 for Linux on x86_64 (Percona Server (GPL), Release 67.0, Revision 618) Will post versions for 5.1 and 5.5