MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 21st, 2012, 09:23 AM
ByGoneYrs's Avatar
ByGoneYrs ByGoneYrs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Location: Southern New Jersey, USA
Posts: 154 ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 19 h 27 m 31 sec
Reputation Power: 64
Send a message via ICQ to ByGoneYrs Send a message via Yahoo to ByGoneYrs
INNODB storage engine - reclaim space

Hello everyone,

Currently we are using MySQL 5.0.51a version and also using the INNODB storage engine. Now if we drop a table from the tablespace, can you reclaim that space.

In Oracle one can Coalesce a tablespace after a large table has been dropped from a tablespace. Thus the system reclaims the space. I understand currently at least with the version that we are on that when we drop a table from INNODB, that the data is dropped and reusable but that the tablespace does not shrink down in size after the table has beed dropped. Is there any way to do this, except taking a export and dropping the whole schema and reimporting it back into a new tablespace?

Thoughts or advice here? Also is there any other commands or ways to do this in either 5.1 or 5.5 and what about 5.6 Beta Test. Also is there actually a 3rd Storage Engine (yet unknown name) on the future as well, or a change to INNODB that would allow this?

Thanks in advance...

Penn

Reply With Quote
  #2  
Old August 21st, 2012, 10:47 AM
ByGoneYrs's Avatar
ByGoneYrs ByGoneYrs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Location: Southern New Jersey, USA
Posts: 154 ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level)ByGoneYrs User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 19 h 27 m 31 sec
Reputation Power: 64
Send a message via ICQ to ByGoneYrs Send a message via Yahoo to ByGoneYrs
Note: that it is our intent here shortly to Upgrade our shop to Enterprise edition 5.5 Now it looks like one can Coalesce a tablespace within that version, is that true? Are there any bugs or how exactly does it work?

Thanks...

Reply With Quote
  #3  
Old August 21st, 2012, 05:58 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,931 E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 43 m 47 sec
Reputation Power: 6991
Quote:
Is there any way to do this, except taking a export and dropping the whole schema and reimporting it back into a new tablespace?

Not unless you enabled innodb_file_per_table before you created your tables (it's off by default).

Quote:
Also is there actually a 3rd Storage Engine (yet unknown name) on the future as well, or a change to INNODB that would allow this?

I'm not aware of any plans for a 3rd storage engine, although it's not something I pay a lot of attention to. There is an open feature request (http://bugs.mysql.com/bug.php?id=1341) to add this feature to InnoDB; don't hold your breath though, it's already been open for 9 years. You can set innodb_file_per_table, but of course that isn't retroactive.

Quote:
Note: that it is our intent here shortly to Upgrade our shop to Enterprise edition 5.5 Now it looks like one can Coalesce a tablespace within that version, is that true? Are there any bugs or how exactly does it work?

I don't know
__________________
PHP FAQ
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
  #4  
Old August 21st, 2012, 10:51 PM
esposj-ninja esposj-ninja is offline
Administrator
Developer Shed Admin.
 
Join Date: Jun 2012
Posts: 17 esposj-ninja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 40 m 26 sec
Reputation Power: 10
You could do a DB migration as part of the 5.5 maintenance window. Depending on data size, it could be a non starter, but that would be the time to get to file_per_table.

I'd want a sql dump anyway besides a binary dump before a major update.

Reply With Quote
  #5  
Old August 29th, 2012, 09:29 AM
RonnyFink RonnyFink is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: Haifa, Israel
Posts: 11 RonnyFink User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 28 sec
Reputation Power: 0
RE: INNODB storage engine - reclaim space

Hey @ByGoneYrs,
In InnoDB there is a single tablespace by default and all data is stored in only one file. The innodb_data_file_path parameter defines the file. In order to reclaim space on InnoDB storage engine, you pretty much have to first export all and re-import:
1. First, of course, backup all your InnoDB tables and export.
2. Change the setting in my.ini/my.cnf as innodb_file_per_table file. There are two options you can try:
a. One option provided by InnoDB is having separate files per table, where the data and indexes of each table can be stored in a separate file using a global variable innodb_file_per_table.
b. Anothe r option is having a fixed tablespace size, which is done by removing autoextend and setting the tablespace size to an extrapolated value. When the limit is reached, you need to clean data.
3. Restart your MySQL server and import the reconfigured tables.
Each of the tables should have its own tablespace and it should be able to can shrink when data is deleted.
Note: There is another option, which is moving all tables, or even whole databases, that contain non-crucial data to MyISAM.
It does require some fiddling, but I hope this helps you a bit
Ronny

Reply With Quote
  #6  
Old October 11th, 2012, 12:36 PM
shumifan50 shumifan50 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 5 shumifan50 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 19 m 57 sec
Reputation Power: 0
Quote:
..that contain non-crucial data to MyISAM

This will cause more problems than it is worth on top of going from transactional to non-transactional storage engine and a much worse locking mechanism.

Mysql 5.6(beta) expands innodb-file-per-table to allow you to put each table file in its own directory(could be different disk). This will allow much more flexibility with innodb and is a long waited for enhancement. You could prepare for this by going file per table in advance.

Reply With Quote
  #7  
Old October 11th, 2012, 12:55 PM
esposj-ninja esposj-ninja is offline
Administrator
Developer Shed Admin.
 
Join Date: Jun 2012
Posts: 17 esposj-ninja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 40 m 26 sec
Reputation Power: 10
Quote:
Originally Posted by shumifan50
This will cause more problems than it is worth on top of going from transactional to non-transactional storage engine and a much worse locking mechanism.

Mysql 5.6(beta) expands innodb-file-per-table to allow you to put each table file in its own directory(could be different disk). This will allow much more flexibility with innodb and is a long waited for enhancement. You could prepare for this by going file per table in advance.


I'm also excited to play with InnoDB full text search in MySQL 5.6. I have a lot of MyISAM tables due to this fact..

I also sat in on a presentation on using Sphinx during Percona Live NYC last week, and I plan on learning, testing, benchmarking, and possibly integrating that into our forums.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > INNODB storage engine - reclaim space

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap