473,473 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

compacting / data size

Hi all!

I am (still) running some tests (dispite my problems), and I'd like to
know the size of data I have in order to calculate growth.

As a test I added some data, 1.69 Gb to be exact to a database, working
with it, then I deleted app 66% of it. When deleting it grew to 1.97
Gb.

I'd like to schrik that, as it will never again hold that amount of
data.
But more important - I'd like to know how much of that is actual data.

The point is, that Id like to delete even more data, and see the size
(of data) again.

How do I do that?

Sonnich

Mar 2 '06 #1
10 3402
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
As a test I added some data, 1.69 Gb to be exact to a database, working
with it, then I deleted app 66% of it. When deleting it grew to 1.97 Gb.


Read about OPTIMIZE TABLE, to reclaim free space and defragment the data
file.

http://dev.mysql.com/doc/refman/5.0/...ize-table.html

Regards,
Bill K.
Mar 2 '06 #2

Bill Karwin wrote:
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
As a test I added some data, 1.69 Gb to be exact to a database, working
with it, then I deleted app 66% of it. When deleting it grew to 1.97 Gb.


Read about OPTIMIZE TABLE, to reclaim free space and defragment the data
file.

http://dev.mysql.com/doc/refman/5.0/...ize-table.html


I have tried this before, and the result is none-existing. My DB is
1.97 GB, and remains. I can free up more than one GB, I just need to
know how.

I read about it, wrote "optimize table mytable", the table remains,
looking at the page mentioned here and looking in the NG has not brough
me to any solution yet.

What exactly should I do?

BR
Sonnich

Mar 3 '06 #3
Sonnich wrote:
Bill Karwin wrote:
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
As a test I added some data, 1.69 Gb to be exact to a database, working
with it, then I deleted app 66% of it. When deleting it grew to 1.97 Gb.

Read about OPTIMIZE TABLE, to reclaim free space and defragment the data
file.

http://dev.mysql.com/doc/refman/5.0/...ize-table.html


I have tried this before, and the result is none-existing. My DB is
1.97 GB, and remains. I can free up more than one GB, I just need to
know how.

I read about it, wrote "optimize table mytable", the table remains,
looking at the page mentioned here and looking in the NG has not brough
me to any solution yet.

What exactly should I do?

BR
Sonnich


How many tables are there in the database? Did you optimize all of them?

Marc
Mar 8 '06 #4
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...

I have tried this before, and the result is none-existing. My DB is
1.97 GB, and remains. I can free up more than one GB, I just need to
know how.


Hmm. Apparently OPTIMIZE TABLE defragments the free space in a table, but
the file size remains the same. I suppose making the free space contiguous
doesn't necessarily mean the free space will be at the end of the file.

Is the table MyISAM or InnoDB? If it is MyISAM, you could copy the table to
a new table of identical structure. Then drop the old table.

If it is InnoDB, you can perform a "dummy" ALTER TABLE, which will cause the
table to be rebuilt (this may take a long time, and temporarily require
additional disk space).

For either storage engine, you can dump the table to a text file, drop the
table, and the restore the table from the dump you made.

See also the commentary threads in these two bugs:
http://bugs.mysql.com/bug.php?id=1287
http://bugs.mysql.com/bug.php?id=1341

Regards,
Bill K.
Mar 8 '06 #5

Marc DVer wrote:
Sonnich wrote:
Bill Karwin wrote:
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
As a test I added some data, 1.69 Gb to be exact to a database, working
with it, then I deleted app 66% of it. When deleting it grew to 1.97 Gb.
Read about OPTIMIZE TABLE, to reclaim free space and defragment the data
file.

http://dev.mysql.com/doc/refman/5.0/...ize-table.html


I have tried this before, and the result is none-existing. My DB is
1.97 GB, and remains. I can free up more than one GB, I just need to
know how.

I read about it, wrote "optimize table mytable", the table remains,
looking at the page mentioned here and looking in the NG has not brough
me to any solution yet.

What exactly should I do?


How many tables are there in the database? Did you optimize all of them?


I have 15 tables, where:

3 are the ones, where data are added to for some temporary time. Once
too old or processed, data are deleted from here again. These tables
are app. 99% of all data I have. They hold 1-4 millions rows each.
2 tables get data when something happens (like a log). Data are not
added often.
4 tables hold "processed data" from the 3 tables above. After 3-4
months of testing they have 1-4000 rows each.
6 tables are lookup data (strings). Mostly less than 10 rows, one has
app 100 rows.

Only the three first ones are being optimized. Thet are the only ones,
where data is being deleted from.

BR
Sonnich

Mar 9 '06 #6

Bill Karwin wrote:
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...

I have tried this before, and the result is none-existing. My DB is
1.97 GB, and remains. I can free up more than one GB, I just need to
know how.
Hmm. Apparently OPTIMIZE TABLE defragments the free space in a table, but
the file size remains the same. I suppose making the free space contiguous
doesn't necessarily mean the free space will be at the end of the file.

Is the table MyISAM or InnoDB? If it is MyISAM, you could copy the table to
a new table of identical structure. Then drop the old table.


InnoDB I asume.

MySQL 5.0, odbcs driver 3.51 (5.0/5.1 does not work properly with
Delphi)
If it is InnoDB, you can perform a "dummy" ALTER TABLE, which will cause the
table to be rebuilt (this may take a long time, and temporarily require
additional disk space).
like adding a field, then dropping it again?
I get the point, but it is too risky, as if it fails, and the programme
is restarted, it might get problems saving data, as I save data this
way:

insert into sfgdfsgdsf values(a,b,c)

If I add "d", then the line above might fail... and then I have system
which does not work.

For either storage engine, you can dump the table to a text file, drop the
table, and the restore the table from the dump you made.
I will taka a look as this...

See also the commentary threads in these two bugs:
http://bugs.mysql.com/bug.php?id=1287
http://bugs.mysql.com/bug.php?id=1341

Regards,
Bill K.


Mar 9 '06 #7
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
If it is InnoDB, you can perform a "dummy" ALTER TABLE, which will cause
the
table to be rebuilt (this may take a long time, and temporarily require
additional disk space).


like adding a field, then dropping it again?


Sorry, I meant to include an example:

ALTER TABLE reallybigtable TYPE=InnoDB;

Assuming the table was already InnoDB to begin with, this makes no change,
but triggers a complete rebuild of the table. As does adding or dropping an
index, etc.

You can check what storage type you're using for a given table called
reallybigtable, as follows:

SHOW TABLE STATUS LIKE 'reallybigtable';

The 'Engine' column shows the storage engine type, e.g. MyISAM or InnoDB.

Regards,
Bill K.
Mar 9 '06 #8

Bill Karwin wrote:
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
If it is InnoDB, you can perform a "dummy" ALTER TABLE, which will cause
the
table to be rebuilt (this may take a long time, and temporarily require
additional disk space).

like adding a field, then dropping it again?

Sorry, I meant to include an example:
ALTER TABLE reallybigtable TYPE=InnoDB;

Assuming the table was already InnoDB to begin with, this makes no change,
but triggers a complete rebuild of the table. As does adding or dropping an
index, etc.

You can check what storage type you're using for a given table called
reallybigtable, as follows:
SHOW TABLE STATUS LIKE 'reallybigtable';
The 'Engine' column shows the storage engine type, e.g. MyISAM or InnoDB.

Regards,
Bill K.


Well they are indeed InnoDB's, but this does still not change
anything... The only result I got was that I got the file ~200 Mb
larger.
I even tried to alter all 15 tables I have, and the result did not
show.

I think I better realise, that there hardly is any solution after
having looking for one for some time, and move on to something else.

BR
Sonnich

Mar 10 '06 #9
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
I think I better realise, that there hardly is any solution after
having looking for one for some time, and move on to something else.


It seems you are right. The MySQL bug #1341 has no resolution at this time.

The ultimate solution might be:
1. Back up _all_ InnoDB databases you have on the system (since they are all
stored in the one file <datadir>/ibdata1)
2. Remove the ibdata1 file with 'rm'
3. Restore your databases

Also consider configuring InnoDB to store databases in one file per table
before you restore the databases. That may make it easier to recover space
on a table-by-table basis in the future.
See http://dev.mysql.com/doc/refman/5.0/...blespaces.html

Regards,
Bill K.
Mar 10 '06 #10

Bill Karwin wrote:
"Sonnich" <so************@elektrobit.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
I think I better realise, that there hardly is any solution after
having looking for one for some time, and move on to something else.


It seems you are right. The MySQL bug #1341 has no resolution at this time.

The ultimate solution might be:
1. Back up _all_ InnoDB databases you have on the system (since they are all
stored in the one file <datadir>/ibdata1)
2. Remove the ibdata1 file with 'rm'
3. Restore your databases

Also consider configuring InnoDB to store databases in one file per table
before you restore the databases. That may make it easier to recover space
on a table-by-table basis in the future.
See http://dev.mysql.com/doc/refman/5.0/...blespaces.html


This might work, but in the project I have, this is not possible.
Unfortunately, I have been thinking of doing this too, but another
reason not to, is that to delete the file I have to stop the service...
this will be something a bit to specific.... and I'll end up speding
too much time on it.

So it might be better to find something else before this gets enterely
out of hand (but sad, as MySQL was the 2nd best option we had).

/S

Mar 10 '06 #11

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

Similar topics

4
by: Jeffrey Sheldon via SQLMonster.com | last post by:
Just wanted to know what is a general rule of thumb when determining log file space against a database's data file. We allow our data file for our database to grow 10%, unlimited. We do not allow...
14
by: John J. Hughes II | last post by:
Using the below code I am send multiple sterilized object across an IP port. This works fine if only one object is received at a time but with packing sometimes there is more then one object or...
2
by: yxq | last post by:
Hello I want to get Windows clipboard data size, seem to use the function "GetClipboardDataSize". Could anyone please tell how to do using vb.net? Thanks
1
by: stabbert | last post by:
We are on DB2 UDB 8.2.2 on AIX. I know this question has been asked many times on the ng but I am just not finding a real good answer. I need to be able to not only determine existing table data...
0
by: srvaspreddy | last post by:
Hi Friends, What are the ways we have to compare data size in DCLGEN and DB2 catalogues?.
2
by: Dave Strydom | last post by:
Hi, I'm getting the following error in my event log: ============ Event Type: Error Event Source: Active Server Pages Event Category: None Event ID: 5 Date: 2007/03/09 Time: 11:50:48 AM
6
by: =?Utf-8?B?SVQgTWFuYWdlcg==?= | last post by:
We are using Windows Server 2003 along with IIS 6. When trying to browse to an ASP page, the following error is returned: Active Server Pages error 'ASP 0107' Data size too large. Size of...
2
by: khalidanwar123 | last post by:
i am getting the following error while updating a clob field. ERROR java.sql.SQLException: Data size bigger than max size forthis type: 4003 19:28:27,499 ERROR at...
1
bilibytes
by: bilibytes | last post by:
Hi everyone, I have new questions for tonight. I would like to know the best ways to prevent Denial Of Service Attacks. Well my question is a bit more precise than that. I can see of three...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.