从表中删除的Mysql Percona太慢了

时间:2016-02-11 10:22:59

标签: mysql percona

请建议

我必须低速从DB中删除记录 例如:对于具有2 000 000条记录的InnoDB表命令“DELETE FROM mytable;需要2分钟。

我认为它太低了。

知道如何解决它并加快速度吗?

服务器配置:

32GB Ram 服务器版本:5.6.27-76.0-log Percona Server(GPL),版本76.0,修订版5498987

戴尔PowerEdge™R730 DX291 240 GB 6 Gb / s SSD

    BUFFER POOL AND MEMORY
----------------------
Total memory allocated 17582522368; in additional pool allocated 0
Total memory allocated by read views 3032
Internal hash tables (constant factor + variable factor)
    Adaptive hash index 2754082160      (302769416 + 2451312744)
    Page hash           4426024 (buffer pool 0 only)
    Dictionary cache    75682369        (70804688 + 4877681)
    File system         1058056         (812272 + 245784)
    Lock system         58954776        (42500456 + 16454320)
    Recovery system     0       (0 + 0)
Dictionary memory allocated 4877681
Buffer pool size        1048572
Buffer pool size, bytes 17179803648
Free buffers            4123
Database pages          893830
Old database pages      329867
Modified db pages       12582
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 2701636, not young 31973635
4.15 youngs/s, 0.82 non-youngs/s
Pages read 813409, created 431679, written 4701725
0.35 reads/s, 1.05 creates/s, 4.52 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: 893830, unzip_LRU len: 0
I/O sum[908]:cur[0], unzip sum[0]:cur[0]
----------------------
INDIVIDUAL BUFFER POOL INFO
----------------------
---BUFFER POOL 0
Buffer pool size        262143
Buffer pool size, bytes 4294950912
Free buffers            1026
Database pages          223314
Old database pages      82414
Modified db pages       3295
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 536380, not young 8933922
0.75 youngs/s, 0.30 non-youngs/s
Pages read 220386, created 103249, written 1751238
0.12 reads/s, 0.27 creates/s, 1.55 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: 223314, unzip_LRU len: 0
I/O sum[227]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size        262143
Buffer pool size, bytes 4294950912
Free buffers            1036
Database pages          223526
Old database pages      82492
Modified db pages       3036
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 796430, not young 11552187
0.70 youngs/s, 0.00 non-youngs/s
Pages read 197712, created 106527, written 967751
0.05 reads/s, 0.30 creates/s, 1.00 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: 223526, unzip_LRU len: 0
I/O sum[227]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 2
Buffer pool size        262143
Buffer pool size, bytes 4294950912
Free buffers            1031
Database pages          223501
Old database pages      82483
Modified db pages       3428
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 683609, not young 6396164
1.87 youngs/s, 0.10 non-youngs/s
Pages read 195760, created 111577, written 925981
0.07 reads/s, 0.22 creates/s, 1.00 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: 223501, unzip_LRU len: 0
I/O sum[227]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 3
Buffer pool size        262143
Buffer pool size, bytes 4294950912
Free buffers            1030
Database pages          223489
Old database pages      82478
Modified db pages       2823
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 685217, not young 5091362
0.82 youngs/s, 0.42 non-youngs/s
Pages read 199551, created 110326, written 1056755
0.10 reads/s, 0.25 creates/s, 0.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: 223489, unzip_LRU len: 0
I/O sum[227]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
7 read views open inside InnoDB
8 RW transactions active inside InnoDB
0 RO transactions active inside InnoDB
8 out of 1000 descriptors used
---OLDEST VIEW---
Normal read view
Read view low limit trx n:o 611342990
Read view up limit trx id 611342990
Read view low limit trx id 611342990
Read view individually stored trx ids:
-----------------
Main thread process no. 5665, id 139640581388032, state: sleeping
Number of rows inserted 55207878, updated 246281303, deleted 51033866, read 177397767449
60.07 inserts/s, 9.02 updates/s, 8.60 deletes/s, 425076.70 reads/s

1 个答案:

答案 0 :(得分:0)

您可以使用Truncate表而不是Delete。它要快得多。为了能够使用它,您必须删除表上的所有约束。很简单,您可以通过3个步骤完成: 1.放弃约束 2.截断表格 3.创建约束