云数据库 GAUSSDB(FOR MYSQL)-delete大表数据后,再查询同一张表时出现慢SQL:场景案例

时间:2024-09-11 14:20:04

场景案例

  1. 假定max_allowed_packet参数大小为1073741824。
  2. 创建表。
    CREATE TABLE IF NOT EXISTS zstest1 
    ( 
    id int  PRIMARY KEY not null, 
    c_longtext LONGTEXT 
    ); 
  3. 向表中插入数据。
    insert into zstest1 values(1, repeat('a', 1073741800)); 
    insert into zstest1 values(2, repeat('a', 1073741800)); 
    insert into zstest1 values(3, repeat('a', 1073741800)); 
    insert into zstest1 values(4, repeat('a', 1073741800)); 
    insert into zstest1 values(5, repeat('a', 1073741800)); 
    insert into zstest1 values(6, repeat('a', 1073741800)); 
    insert into zstest1 values(7, repeat('a', 1073741800)); 
    insert into zstest1 values(8, repeat('a', 1073741800)); 
    insert into zstest1 values(9, repeat('a', 1073741800)); 
    insert into zstest1 values(10, repeat('a', 1073741800)); 
  4. 删除数据。
    delete from zstest1; 
  5. 执行查询语句。
    select id from zstest1;    //执行缓慢
support.huaweicloud.com/trouble-gaussdbformysql/gaussdbformysql_trouble_0203.html