473,245 Members | 1,658 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,245 software developers and data experts.

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 3395
"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
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.