If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > delete records and dB size

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-26-08, 16:30
ammad ammad is offline
Registered User
 
Join Date: Aug 2008
Posts: 24
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 ?
Reply With Quote
  #2 (permalink)  
Old 08-26-08, 22:10
ammad ammad is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 08-27-08, 01:59
snorp snorp is offline
Registered User
 
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".
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On