tags:

views:

35

answers:

3

plz give answer

+1  A: 

That is a task for the DBMS, not yours.

vulkanino
+3  A: 

As far as I can see, you can be meaning two things.

  • Physically re-using "empty space" that a deleted row left: Don't worry. The database engine and your OS's filesystem will take care of that. Deleting rows may indeed create some fragmentation, but not forever.

  • Re-using a unique, incremental ID after deleting a record: You shouldn't do that, as it can lead to all kinds of data integrity problems. Unique IDs should never be reused.

mySQL's OPTIMIZE TABLE command (docs here, thanks @Bobby for mentioning it in your comment) can be used to defragment a table after large delete operations.

Pekka
A: 

And if you're talking about an InnoDB database, the InnoDB data file won't shrink if you delete data. It will only grow.

If you delete data in this file you won't get harddisk space back, but MySQL will use the newly freed space to store new records.

If you need to reclaim the disk space I think you should dump the database, re-install MySQL and read the dump or something like that.

extraneon