MySQL 一个表,向里面Insert了200多万条数据后, SELECT 很慢.
然后我把数据删光,只加一条数据, SELECT 还是很慢?
如何进行优化?或者做什么操作可以让数据库恢复正常?

解决方案 »

  1.   

    --看看你的日誌是不是滿了
    --不知道mysql怎麼清理的,以下mssql的
    DUMP TRANSACTION 庫名 WITH no_log
    GO
    dbcc shrinkfile(logfilename)
      

  2.   

    把数据删光  用的是truncate table XXX 吗
      

  3.   


    --收缩简单恢复模式数据库日志,收缩后@database_name_log的大小单位为M 
      backup log @database_name with no_log 
      dbcc shrinkfile (@database_name_log, 5) 
      

  4.   


    MySQL 有这命令吗?mysql> backup log @lizlog with no_log;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near 'log @
    lizlog with no_log' at line 1
      

  5.   


    MySQL 有这命令吗? mysql> DUMP TRANSACTION lizlog with no_log;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near 'DUMP
     TRANSACTION lizlog with no_log' at line 1
      

  6.   

    在這個板塊回答的基本都是mssql的語法絲路
      

  7.   

    用MYSQL语法重建索引或更新表统计信息