How can i clean temp tables on mysql

a 夏天 提交于 2019-12-13 15:26:11

问题


We are creating temp table in procedures and we use no persistent connection for mysql. There are many temp tables is increasing slowly after mysql restart and then the innodb_buffer_pool_size is finishing.

The application is working on this server;

CPU E3-1245 v5 @ 3.50GHz - 8 core 16GB Ram

The image shows tmp tables how increasing is:

My.cnf:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

skip_name_resolve

join_buffer_size = 4M
sort_buffer_size = 1M
read_rnd_buffer_size = 1M

# MyISAM #
key_buffer_size                 = 1G
# SAFETY #
max_allowed_packet              = 1G
# CACHES AND LIMITS #
tmp_table_size                 = 16M
max_heap_table_size            = 16M
query_cache_type               = 1
query_cache_size               = 1M
query_cache_limit              = 1M
max_connections                = 400
thread_cache_size              = 100
open_files_limit               = 65535
table_definition_cache         = 4096
table_open_cache               = 4096

# INNODB #
innodb_flush_method            = O_DIRECT
innodb_log_files_in_group      = 2
innodb_log_file_size           = 512M
innodb_flush_log_at_trx_commit = 1
innodb_file_per_table          = 1
innodb_buffer_pool_size        = 10G
innodb_buffer_pool_instances=8
thread_pool_size=36

InnoDB Status:

=====================================
2017-05-31 15:52:22 7fbabc7be700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 59 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 9224 srv_active, 0 srv_shutdown, 9 srv_idle
srv_master_thread log flush and writes: 9233
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 134197
OS WAIT ARRAY INFO: signal count 204301
Mutex spin waits 1288150, rounds 3214506, OS waits 81031
RW-shared spins 54484, rounds 1299121, OS waits 39945
RW-excl spins 11585, rounds 514527, OS waits 12875
Spin rounds per wait: 2.50 mutex, 23.84 RW-shared, 44.41 RW-excl
------------
TRANSACTIONS
------------
Trx id counter 11882875981
Purge done for trx's n:o < 11882875606 undo n:o < 0 state: running but idle
History list length 1889
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 11882874682, not started
MySQL thread id 73473, OS thread handle 0x7fbaafdb6700, query id 100862972 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882874410, not started
MySQL thread id 73472, OS thread handle 0x7fbaca279700, query id 100862026 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875975, not started
MySQL thread id 73447, OS thread handle 0x7fbacf446700, query id 100867583 XXX.XXX.XXX.XXX root closing tables
select * from `sportsbook_maindb`.`feed_event_odds` where `sportsbook_maindb`.`feed_event_odds`.`feed_event_id` in ('1811069')
---TRANSACTION 0, not started
MySQL thread id 73442, OS thread handle 0x7fbab09f7700, query id 100839940 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882867252, not started
MySQL thread id 73426, OS thread handle 0x7fbacfb21700, query id 100836223 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875822, not started
MySQL thread id 73428, OS thread handle 0x7fbab9b7d700, query id 100866992 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 73423, OS thread handle 0x7fbaafbef700, query id 100831913 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882872555, not started
MySQL thread id 73325, OS thread handle 0x7fbac77be700, query id 100855753 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875960, not started
MySQL thread id 73326, OS thread handle 0x7fbacfef0700, query id 100867542 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882843879, not started
MySQL thread id 73320, OS thread handle 0x7fbab37be700, query id 100746169 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882853250, not started
MySQL thread id 73229, OS thread handle 0x7fbac76ba700, query id 100786064 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875978, not started
MySQL thread id 73231, OS thread handle 0x7fbabf2fb700, query id 100867594 XXX.XXX.XXX.XXX root Opening tables
select * from `sportsbook_maindb`.`feed_events` where (`feed_id` = ? and `provider_event_id` = ? and `type` = ? and `sport_id` = ? and `category_id` = ? and `tournament_id` = ?) limit 1
---TRANSACTION 11882822134, not started
MySQL thread id 73227, OS thread handle 0x7fbacfa1d700, query id 100661334 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882820779, not started
MySQL thread id 73051, OS thread handle 0x7fbac2679700, query id 100655871 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882830983, not started
MySQL thread id 73136, OS thread handle 0x7fbac27be700, query id 100698647 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 73133, OS thread handle 0x7fbab0b7d700, query id 100549256 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875805, not started
MySQL thread id 73052, OS thread handle 0x7fbab27ff700, query id 100867298 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882782336, not started
MySQL thread id 73046, OS thread handle 0x7fbab0bbe700, query id 100427035 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882820807, not started
MySQL thread id 73031, OS thread handle 0x7fbaaffbe700, query id 100656320 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882777845, not started
MySQL thread id 73024, OS thread handle 0x7fbac273c700, query id 100398964 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882753941, not started
MySQL thread id 72930, OS thread handle 0x7fbac26fb700, query id 100251756 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875973, not started
MySQL thread id 72931, OS thread handle 0x7fbac3fff700, query id 100867580 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882752465, not started
MySQL thread id 72923, OS thread handle 0x7fbac4fff700, query id 100241832 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875977, not started
MySQL thread id 72832, OS thread handle 0x7fbaafb6d700, query id 100867592 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882734325, not started
MySQL thread id 72825, OS thread handle 0x7fbac3fbe700, query id 100112673 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882732381, not started
MySQL thread id 72809, OS thread handle 0x7fbac777d700, query id 100100554 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875893, not started
MySQL thread id 72810, OS thread handle 0x7fbac75b6700, query id 100867279 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 72806, OS thread handle 0x7fbab0afb700, query id 100089215 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882861085, not started
MySQL thread id 72712, OS thread handle 0x7fbabf2ba700, query id 100815085 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875962, not started
MySQL thread id 72713, OS thread handle 0x7fbaca238700, query id 100867543 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 72709, OS thread handle 0x7fbac76fb700, query id 99960334 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882861460, not started
MySQL thread id 72694, OS thread handle 0x7fbacf342700, query id 100816387 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875979, not started
MySQL thread id 72695, OS thread handle 0x7fbabf33c700, query id 100867609 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882711034, not started
MySQL thread id 72692, OS thread handle 0x7fbac7679700, query id 99941737 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882861262, not started
MySQL thread id 72673, OS thread handle 0x7fbab37ff700, query id 100816282 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875804, not started
MySQL thread id 72674, OS thread handle 0x7fbacb5b6700, query id 100867297 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 72670, OS thread handle 0x7fbabf37d700, query id 99922018 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11881700879, not started
MySQL thread id 66986, OS thread handle 0x7fbabc7ff700, query id 93448633 185.81.238.240 root cleaning up
---TRANSACTION 0, not started
MySQL thread id 55432, OS thread handle 0x7fbaafdf7700, query id 75618608 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 7548, OS thread handle 0x7fbabc7be700, query id 100867611 185.81.238.240 root init
SHOW ENGINE INNODB STATUS
---TRANSACTION 0, not started
MySQL thread id 7538, OS thread handle 0x7fbac773c700, query id 100635363 185.81.238.240 root cleaning up
---TRANSACTION 11882245426, not started
MySQL thread id 31645, OS thread handle 0x7fbabf3ff700, query id 96827866 185.81.238.240 root cleaning up
---TRANSACTION 11882679493, not started
MySQL thread id 14852, OS thread handle 0x7fbac3f7d700, query id 99698982 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11873625990, not started
MySQL thread id 14125, OS thread handle 0x7fbaca1f7700, query id 99540454 185.81.238.240 root cleaning up
---TRANSACTION 0, not started
MySQL thread id 14109, OS thread handle 0x7fbac75f7700, query id 99547660 185.81.238.240 root cleaning up
---TRANSACTION 11868523434, not started
MySQL thread id 9205, OS thread handle 0x7fbac4fbe700, query id 12801623 185.81.238.240 root cleaning up
---TRANSACTION 11882248288, not started
MySQL thread id 1212, OS thread handle 0x7fbacff72700, query id 96849893 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11867848641, not started
MySQL thread id 6329, OS thread handle 0x7fbac27ff700, query id 8328197 185.81.238.240 root cleaning up
---TRANSACTION 11882672192, not started
MySQL thread id 1285, OS thread handle 0x7fbaca2fb700, query id 99644576 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882860394, not started
MySQL thread id 1392, OS thread handle 0x7fbacb5f7700, query id 100812088 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882868595, not started
MySQL thread id 1273, OS thread handle 0x7fbacb7ff700, query id 100841204 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875605, not started
MySQL thread id 1213, OS thread handle 0x7fbacfba3700, query id 100866459 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882559726, not started
MySQL thread id 1220, OS thread handle 0x7fbacfdab700, query id 100859394 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882873636, not started
MySQL thread id 1226, OS thread handle 0x7fbacb73c700, query id 100859395 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882248273, not started
MySQL thread id 1215, OS thread handle 0x7fbacfae0700, query id 96848359 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882875772, not started
MySQL thread id 1214, OS thread handle 0x7fbacf1bc700, query id 100866766 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11866588339, not started
MySQL thread id 1207, OS thread handle 0x7fbacf793700, query id 451924 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 1202, OS thread handle 0x7fbacfd29700, query id 450403 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882874899, not started
MySQL thread id 1210, OS thread handle 0x7fbacf8d8700, query id 100863723 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11866588171, not started
MySQL thread id 1208, OS thread handle 0x7fbacf856700, query id 450371 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 1203, OS thread handle 0x7fbacf3c4700, query id 447224 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11866588173, not started
MySQL thread id 1199, OS thread handle 0x7fbacfe2d700, query id 449824 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 1198, OS thread handle 0x7fbacfbe4700, query id 445625 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 1193, OS thread handle 0x7fbacfc66700, query id 445271 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 1191, OS thread handle 0x7fbacf919700, query id 444828 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 0, not started
MySQL thread id 1187, OS thread handle 0x7fbacf509700, query id 444521 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11866586787, not started
MySQL thread id 1180, OS thread handle 0x7fbacf815700, query id 435638 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882847402, not started
MySQL thread id 1165, OS thread handle 0x7fbacfb62700, query id 100755663 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882846956, not started
MySQL thread id 1174, OS thread handle 0x7fbacfe6e700, query id 100751802 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882854010, not started
MySQL thread id 1164, OS thread handle 0x7fbacf2c0700, query id 100783528 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882868602, not started
MySQL thread id 1175, OS thread handle 0x7fbacf383700, query id 100835995 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882867289, not started
MySQL thread id 1173, OS thread handle 0x7fbacf60d700, query id 100836224 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882868383, not started
MySQL thread id 1170, OS thread handle 0x7fbacf27f700, query id 100840305 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882852181, not started
MySQL thread id 1171, OS thread handle 0x7fbacf1fd700, query id 100780084 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882870222, not started
MySQL thread id 1172, OS thread handle 0x7fbacf4c8700, query id 100847395 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882852652, not started
MySQL thread id 1167, OS thread handle 0x7fbacf897700, query id 100782309 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882846493, not started
MySQL thread id 1166, OS thread handle 0x7fbacf487700, query id 100751540 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882851661, not started
MySQL thread id 1168, OS thread handle 0x7fbacfeaf700, query id 100776989 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882860508, not started
MySQL thread id 1169, OS thread handle 0x7fbacf23e700, query id 100809213 XXX.XXX.XXX.XXX root cleaning up
---TRANSACTION 11882874001, not started
MySQL thread id 1163, OS thread handle 0x7fbacf5cc700, query id 100857358 XXX.XXX.XXX.XXX root cleaning up
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] ,
 ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
Pending flushes (fsync) log: 0; buffer pool: 0
32109 OS file reads, 293736 OS file writes, 232781 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 43.93 writes/s, 22.91 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 35016, seg size 35018, 24 merges
merged operations:
 insert 22, delete mark 33, delete 28
discarded operations:
 insert 0, delete mark 0, delete 0
33987.71 hash searches/s, 12676.14 non-hash searches/s
---
LOG
---
Log sequence number 5161042928416
Log flushed up to   5161042928396
Pages flushed up to 5160903870455
Last checkpoint at  5160903858993
Max checkpoint age    869019772
Checkpoint age target 841862905
Modified age          139057961
Checkpoint age        139069423
0 pending log writes, 0 pending chkp writes
150467 log i/o's done, 14.02 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 11177820160; in additional pool allocated 0
Total memory allocated by read views 6056
Internal hash tables (constant factor + variable factor)
    Adaptive hash index 225887008   (169996984 + 55890024)
    Page hash           1329176 (buffer pool 0 only)
    Dictionary cache    44357318    (42500624 + 1856694)
    File system         1016392     (812272 + 204120)
    Lock system         26592536    (26563016 + 29520)
    Recovery system     0   (0 + 0)
Dictionary memory allocated 1856694
Buffer pool size        655352
Buffer pool size, bytes 10737287168
Free buffers            516293
Database pages          135648
Old database pages      6591
Modified db pages       4137
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 35523, not young 435533
0.00 youngs/s, 0.00 non-youngs/s
Pages read 31888, created 103783, written 81574
0.00 reads/s, 6.53 creates/s, 24.59 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 135648, unzip_LRU len: 0
I/O sum[11240]:cur[24], unzip sum[0]:cur[0]
----------------------
INDIVIDUAL BUFFER POOL INFO
----------------------
---BUFFER POOL 0
Buffer pool size        81919
Buffer pool size, bytes 1342160896
Free buffers            63808
Database pages          17688
Old database pages      860
Modified db pages       738
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 12, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 4203, created 13485, written 13119
0.00 reads/s, 1.24 creates/s, 3.66 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 17688, unzip_LRU len: 0
I/O sum[1405]:cur[3], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size        81919
Buffer pool size, bytes 1342160896
Free buffers            64232
Database pages          17262
Old database pages      839
Modified db pages       562
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 9792, not young 109004
0.00 youngs/s, 0.00 non-youngs/s
Pages read 4346, created 12919, written 10360
0.00 reads/s, 0.39 creates/s, 3.47 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 17262, unzip_LRU len: 0
I/O sum[1405]:cur[3], unzip sum[0]:cur[0]
---BUFFER POOL 2
Buffer pool size        81919
Buffer pool size, bytes 1342160896
Free buffers            64815
Database pages          16669
Old database pages      810
Modified db pages       476
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 8543, not young 77383
0.00 youngs/s, 0.00 non-youngs/s
Pages read 3728, created 12949, written 9935
0.00 reads/s, 0.34 creates/s, 2.61 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 16669, unzip_LRU len: 0
I/O sum[1405]:cur[3], unzip sum[0]:cur[0]
---BUFFER POOL 3
Buffer pool size        81919
Buffer pool size, bytes 1342160896
Free buffers            64752
Database pages          16742
Old database pages      813
Modified db pages       505
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 2, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 3869, created 12873, written 10276
0.00 reads/s, 0.37 creates/s, 3.02 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 16742, unzip_LRU len: 0
I/O sum[1405]:cur[3], unzip sum[0]:cur[0]
---BUFFER POOL 4
Buffer pool size        81919
Buffer pool size, bytes 1342160896
Free buffers            64542
Database pages          16953
Old database pages      824
Modified db pages       485
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 9168, not young 130820
0.00 youngs/s, 0.00 non-youngs/s
Pages read 4085, created 12872, written 10275
0.00 reads/s, 0.34 creates/s, 2.71 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 16953, unzip_LRU len: 0
I/O sum[1405]:cur[3], unzip sum[0]:cur[0]
---BUFFER POOL 5
Buffer pool size        81919
Buffer pool size, bytes 1342160896
Free buffers            64649
Database pages          16842
Old database pages      818
Modified db pages       503
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 5, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 3936, created 12906, written 9149
0.00 reads/s, 0.88 creates/s, 2.97 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 16842, unzip_LRU len: 0
I/O sum[1405]:cur[3], unzip sum[0]:cur[0]
---BUFFER POOL 6
Buffer pool size        81919
Buffer pool size, bytes 1342160896
Free buffers            64770
Database pages          16725
Old database pages      812
Modified db pages       369
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 3, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 4005, created 12720, written 8895
0.00 reads/s, 1.44 creates/s, 2.95 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 16725, unzip_LRU len: 0
I/O sum[1405]:cur[3], unzip sum[0]:cur[0]
---BUFFER POOL 7
Buffer pool size        81919
Buffer pool size, bytes 1342160896
Free buffers            64725
Database pages          16767
Old database pages      815
Modified db pages       499
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 7998, not young 118326
0.00 youngs/s, 0.00 non-youngs/s
Pages read 3716, created 13059, written 9565
0.00 reads/s, 1.53 creates/s, 3.20 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 16767, unzip_LRU len: 0
I/O sum[1405]:cur[3], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
2 read views open inside InnoDB
0 RW transactions active inside InnoDB
0 RO transactions active inside InnoDB
0 out of 1000 descriptors used
---OLDEST VIEW---
Normal read view
Read view low limit trx n:o 11882876173
Read view up limit trx id 11882876173
Read view low limit trx id 11882876173
Read view individually stored trx ids:
-----------------
Main thread process no. 9910, id 140440435156736, state: sleeping
Number of rows inserted 345653, updated 2558529, deleted 1158, read 1100668819
18.75 inserts/s, 560.38 updates/s, 0.00 deletes/s, 125493.04 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

How can i figure the problem out? I read many articles about mysql, I tried to kill connections, I tried to drop tmp tables but i could not resolve it.


回答1:


I notice many of your InnoDB threads are stuck in the state of "cleaning up."

There's a bug https://bugs.mysql.com/bug.php?id=78777 about threads being stuck in that state. It is reported to be fixed in MySQL 5.6.35, 5.7.17, 8.0.1. You should upgrade to those versions if you have not done so already.

Another suggestion is to increase the size of table_open_cache. Monitor the status variables Open_tables and Opened_tables.

More reading:

  • https://dev.mysql.com/doc/refman/5.7/en/table-cache.html
  • https://dba.stackexchange.com/questions/45551/how-to-optimize-table-cache for some tips.



回答2:


SHOW GLOBAL STATUS LIKE 'Qc%'

Show us the results of that, then increase:

query_cache_size = 50M   -- but not more than this

Assuming that does not suffice, then provide

RAM size (16GB?)
SHOW VARIABLES;
SHOW GLOBAL STATUS; -- but only after being up at least 24 hours.

This is so we can discuss possible speedup in the 2 queries that are visible in the Innodb status:

SHOW CREATE TABLE feed_events;

Do you have other queries that often show up?

Please discuss the creation of connections. How often? Etc. I am fishing for whether thread pooling is worth having.

Changing thus is a 'quick win', but at the expense of some security:

innodb_flush_log_at_trx_commit = 2


来源:https://stackoverflow.com/questions/44289692/how-can-i-clean-temp-tables-on-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!