Home » Performance » MySQL » what is the purpose of ibdata1,ib_logfile0,ib_logfile1
what is the purpose of ibdata1,ib_logfile0,ib_logfile1 [message #1437] Mon, 18 June 2007 01:29 Go to next message
julian  is currently offline julian
Messages: 13
Registered: March 2007
Junior Member
Hi


I'm new to mysql. In /var/lib/mysql directory I'm creating databases. I'm using InnoDB storage engine. In this directory three files namely ibdata1,ib_logfile0,ib_logfile1 created automatically. What is the use of these files and it contains any information? If I deleted these files what happens?



Any one answer for this doubt.
Re: what is the purpose of ibdata1,ib_logfile0,ib_logfile1 [message #1438 is a reply to message #1437 ] Mon, 18 June 2007 02:23 Go to previous messageGo to next message
babuno5  is currently offline babuno5
Messages: 7
Registered: June 2007
Location: India
Junior Member

Dont delete the files. Those are the files where the actual data, indexes and the innodb log are stored for all innodb databases
Re: what is the purpose of ibdata1,ib_logfile0,ib_logfile1 [message #1439 is a reply to message #1437 ] Mon, 18 June 2007 02:58 Go to previous messageGo to next message
julian  is currently offline julian
Messages: 13
Registered: March 2007
Junior Member
If we insert records in the db, will the size of these files increase?.

Will these files affects the execution speed.

If databases r deleted will the size of these files decrease?


Re: what is the purpose of ibdata1,ib_logfile0,ib_logfile1 [message #1440 is a reply to message #1439 ] Mon, 18 June 2007 03:23 Go to previous messageGo to next message
sterin  is currently offline sterin
Messages: 323
Registered: March 2007
Location: Sweden
Senior Member
Quote:


If we insert records in the db, will the size of these files increase?.


Yes when the ibdata1 file is to small for the amount of data that you are trying store in it. It will grow automatically.
The ib_logfile files will continue to be the same size always, they do not grow.

Quote:


Will these files affects the execution speed.


The question isn't if the files will affect the execution speed.

The quesiton is if more _data_ in the database will affect execution speed, and the answer is, yes more data in the database will affect execution speed.
But if you have proper indexes in your tables you will not notice it that much.

Quote:


If databases r deleted will the size of these files decrease?


No, unfortunately not.
But generally when you have a database you seldom have the situation that you need to shrink the table space.
Because often the size of a database is either growing or pretty stable in size.

[Updated on: Mon, 18 June 2007 03:24]

Re: what is the purpose of ibdata1,ib_logfile0,ib_logfile1 [message #1489 is a reply to message #1440 ] Tue, 26 June 2007 10:39 Go to previous messageGo to next message
noqlew2  is currently offline noqlew2
Messages: 6
Registered: June 2007
Location: New Jersey
Junior Member
sterin wrote on Mon, 18 June 2007 03:23


No, unfortunately not.
But generally when you have a database you seldom have the situation that you need to shrink the table space.
Because often the size of a database is either growing or pretty stable in size.



I once had to drop a 2 GB table, but the ibdata file did not reflect this. There is no way to reclaim this empty space?
Re: what is the purpose of ibdata1,ib_logfile0,ib_logfile1 [message #1490 is a reply to message #1489 ] Tue, 26 June 2007 10:57 Go to previous messageGo to next message
sterin  is currently offline sterin
Messages: 323
Registered: March 2007
Location: Sweden
Senior Member
A very cumbersum way:
1.
mysqldump all databases

2.
Remove the ibdata1 file.

3.
Start the mysqld process.
It will now recreate the ibdata1 table space since it recognizes that it is missing.

4.
Import the sql dump from step 1 and you are back again.


But as you see it is not a fun operation so unless you need the 2GB space I wouldn't recommend it.
Re: what is the purpose of ibdata1,ib_logfile0,ib_logfile1 [message #1495 is a reply to message #1437 ] Wed, 27 June 2007 16:31 Go to previous message
TheCowGod  is currently offline TheCowGod
Messages: 4
Registered: June 2007
Location: Covington, LA
Junior Member
If you're using the innodb_file_per_table option, then each InnoDB table gets its own .ibd file, so you can recover freed-up space in a table by rebuilding just that one table. The easiest way to rebuild an InnoDB table is to run the command, "ALTER TABLE tablename ENGINE=InnoDB;". However, this will build the new copy of the table on disk before dropping the old one, so you'll need to have enough free disk space to keep the entire second copy of the table. If you're tight on disk space on the database server (which is probably why you want to free up the space trapped in the InnoDB tablespace in the first place), then you can mysqldump the table to another machine with more free space and then re-import it back into the database server. It's still a pain to have to do that, but it's a lot better than having to dump ALL of your tables.
Previous Topic:Tuning server for very large (250GB) data sets
Next Topic:InnoDB's compact row format
Goto Forum:
  



Current Time: Thu Jan 8 16:58:34 EST 2009

Total time taken to generate the page: 0.03975 seconds
.:: Contact :: Home :: MySQL Support by Percona.com ::.

Powered by: FUDforum 2.7.5.
Copyright ©2001-2006 FUD Forum Bulletin Board Software

MySQL Performance | Forum authority Badge