List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 17 1999 2:46pm
Subject:Re: real megabyte usage of a database
View as plain text  
At 4:22 PM +0200 7/17/99, Christian Hammers wrote:
>Hello
>
>We offer mysql database access to our clients, but now we need to account
>the usage of this databases.
>
>Can we just make a "du -s -k /var/lib/mysql/databasename" or are this files
>sometimes bigger than the actual used data ?

The files can be bigger than the actual data, because when MySQL deletes
a record, there will be a hole in the data file.  (It'll reallocate that
space if a new record is inserted later that fits in the hole.)  OPTIMIZE
TABLE gets rid of these holes.


But you should also watch out for databases that aren't actually located
in the data directory.  They might be symlinks to somewhere else.  You'll
probably notice this as a very low du value. :-)  Some versions of du have
an option that allows you to follow symlinks, for example, du -L on FreeBSD.

--
Paul DuBois, paul@stripped
Thread
real megabyte usage of a databaseChristian Hammers17 Jul
  • Re: real megabyte usage of a databaseT├Ánu Samuel17 Jul
  • Re: real megabyte usage of a databasePaul DuBois17 Jul