473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Packing needed for MySQL?

Hi all!

I am still playing around with databases. So here it goes:

Is packing needed for MySQL (5.0)?

I have a new DB, which already is 178 MB. Will that continue to grow,
when I add and delete data? Does it reclaim freed space and deleted
rows?

If not, is there a (automated) way to pack tables using SQL or
something simple, which I can call from my app?

Sonnich

Jan 25 '06 #1
2 1950
>I am still playing around with databases. So here it goes:

Is packing needed for MySQL (5.0)?
No, for various definitions of "needed".
I have a new DB, which already is 178 MB. Will that continue to grow,
when I add and delete data? Does it reclaim freed space and deleted
rows?
MySQL will reclaim freed space but it will NOT necessarily give
it back to the OS. It will re-use it.
If not, is there a (automated) way to pack tables using SQL or
something simple, which I can call from my app?


There are a number of commands which will copy a table to itself and
in the process take all the unused space out of MyISAM tables (hope
you have enough disk space for *two* copies of the table, temporarily):

ALTER TABLE
OPTIMIZE TABLE
REPAIR TABLE

I think these free up partially-unused blocks in InnoDB tables as well.

Gordon L. Burditt
Jan 25 '06 #2
I have a new DB, which already is 178 MB. Will that continue to grow,
when I add and delete data? Does it reclaim freed space and deleted
rows?

MySQL will reclaim freed space but it will NOT necessarily give
it back to the OS. It will re-use it.
If not, is there a (automated) way to pack tables using SQL or
something simple, which I can call from my app?

There are a number of commands which will copy a table to itself and
in the process take all the unused space out of MyISAM tables (hope
you have enough disk space for *two* copies of the table, temporarily):
ALTER TABLE
OPTIMIZE TABLE
REPAIR TABLE
I think these free up partially-unused blocks in InnoDB tables as well.


Thanks, here is how I found it works:

When simply optimizing, the file grows to 294 MB. Seems like the copies
takes up the space.

When deleting rows, then it only grows to 258 MB (it is adding data
too). After that optimizing is much faster and does not require more
space.

Thanks
Sonnich

Jan 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: BT | last post by:
Hi, I am trying to install php-mysql-4.0.6-7.i386.rpm(to get php to work with mysql as suggested for my earlier error). I get the following error for rpm -i php-mysql-4.0.6-7.i386.rpm. Error...
0
by: nobull | last post by:
Google won't let me post this as a follow-up but lynch@agere.com (lynto) wrote in message news:<503469eb.0407271148.7ee4b0ca@posting.google.com>... > Does anyone have an algorithm for packing...
0
by: System | last post by:
Hello All, Redhat 9.0 Mysql 3.23.56 ==> Running I want to upgarde to 4.0.13 but this is the error it says: # rpm -Uvh MySQL-server-4.0.13-0.i386.rpm warning: MySQL-server-4.0.13-0.i386.rpm: V3...
2
by: gbb0330 | last post by:
Hi all I need some advice. the daily packing number will be used to match a box with its label. the guys in the warehouse will get a list of items to pack. they will find the item - put it...
1
by: gbb0330 | last post by:
hi guys -the code (all capital letters) generates daily packing number, it is in the on click event of a command button that moves to the next record. dpkn is unbound control - i use it to...
18
by: Edward Diener | last post by:
Is the packing alignment of __nogc classes stored as part of the assembly ? I think it must as the compiler, when referencing the assembly, could not know how the original data is packed otherwise....
1
by: Gajendra | last post by:
How does the byte packing and the byte alignment work in VC++ compiler? What is the effect of #pragma pack(n) on the alignment and byte packing for example while using the structur struc double...
4
by: Sonnich | last post by:
Hi all! I am new to MySQL, and I have to short questions: I have MySQL on W2K, with a DB where I store date for app. one month, then I delete them. How can I pack the database, so I get a...
9
by: fraz | last post by:
Does anyone have code to solve a 3-d bin packing problem in php? I am trying to solve the issue of packing various sized rectangular shaped objects into boxes of three different sizes so as to use...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.