Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2008
    Posts
    24

    Unanswered: delete records and dB size

    dear all,

    i would like to ask a question form experts; if i delete records will i get used space or not.




    [root@DBS mus]# du -s test_t.*
    12K test_t.frm
    21G test_t.MYD
    4K test_t.MYI

    mysql> delete from test_t where time < 1217530799;
    Query OK, 43100099 rows affected (7 min 22.06 sec)

    mysql> commit;
    Query OK, 0 rows affected (0.00 sec)


    [root@DBS mus]# du -s test_t.*
    12K test_t.frm
    21G test_t.MYD
    4K test_t.MYI


    Any idea ?

  2. #2
    Join Date
    Aug 2008
    Posts
    24
    MySQL dont like to delete records,

    OPTIMIZE TABLE should be used if you have deleted a large part of a table or if you have made many changes to a table with variable-length rows

  3. #3
    Join Date
    Apr 2004
    Location
    Europe->Sweden->Stockholm
    Posts
    71
    Quote Originally Posted by ammad
    MySQL dont like to delete records, ...
    The records are deleted, but there is free space left in the database file. Even though intuition might suggest otherwise, shrinking the database file is actually a non-trivial operation and MySQL will never try do to that "on-the-fly".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •