clean up tables after deletes

clean up tables after deletes

am 01.04.2007 16:43:27 von clb

I noticed that in phpMyAdmin there is a way to cleanup and compact
tables that have had lots of deletes done to them. Can anyone tell me
how to do that manually? I find phpMyAdmin to be a pain so I don't want
to use it but I would like to compact some tables that got bloated with
testing and are now much smaller than before. The main reason I want to
clean them up is that new records go into slots previously used and
deleted instead of going at the end, where they naturally belong
(chronologically). Thanks.

Re: clean up tables after deletes

am 02.04.2007 00:49:29 von gordonb.pe07w

>I noticed that in phpMyAdmin there is a way to cleanup and compact
>tables that have had lots of deletes done to them. Can anyone tell me
>how to do that manually?

OPTIMIZE TABLE or REPAIR TABLE

Also, if you want to do a lot of them, see mysqlcheck.

>I find phpMyAdmin to be a pain so I don't want
>to use it but I would like to compact some tables that got bloated with
>testing and are now much smaller than before. The main reason I want to
>clean them up is that new records go into slots previously used and
>deleted instead of going at the end, where they naturally belong
>(chronologically). Thanks.

In SQL, records do not have an order, unless you use ORDER BY. The
physical location of records is not something you should be worrying
about or depending on.