Happy Alen Touring Birthday Centennial.
Monday, June 25, 2012
Monday, April 30, 2012
MySQL Innodb Size Reduction by Partitioning
I've faced space limitation on hard dis, so finally found partitioning as a good option to manage old data for removing and freeing space (innodb doesn't free deleted data space back to OS). By partitioning you can discard a partition for example 1 month data and it release the used space by that partition file.
You can delete unused data from table before execute it, to free some space on just partitioning without truncating a partition.
This is the batch query for slicing a table, Using a temp table to prevent lock of update query while partitioning.
ALTER TABLE EventLog RENAME TO EventLogTmp;
CREATE TABLE EventLog (
DateTime datetime NOT NULL,
Node varchar(16) NOT NULL,
Event varchar(512) NOT NULL,
Count int(10) unsigned NOT NULL,
PRIMARY KEY (DateTime , Node , Event) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE EventLogTmp
Partition by Range(Year(DateTime))
(
Partition OldYearsP Values Less Than(2010),
Partition Y2010P Values Less Than(2011),
Partition Y2011P Values Less Than(2012),
Partition Y2012P Values Less Than(2013),
Partition Y2013P Values Less Than(2014),
Partition Y2014P Values Less Than(2015),
Partition FutYearsP Values Less Than(2050)
);
ALTER TABLE EventLog RENAME TO EventLogTmp3;
ALTER TABLE EventLogTmp RENAME TO EventLog;
INSERT INTO EventLog Select * From EventLogTmp3;
ALTER TABLE EventLog DROP PARTITION OldYearsP;
If you want to rotate a partition like monthly partition, you can make backup of data and then truncate data inside.
ALTER TABLE EventLog TRUNCATE PARTITION Y2012P;
You can delete unused data from table before execute it, to free some space on just partitioning without truncating a partition.
This is the batch query for slicing a table, Using a temp table to prevent lock of update query while partitioning.
ALTER TABLE EventLog RENAME TO EventLogTmp;
CREATE TABLE EventLog (
DateTime datetime NOT NULL,
Node varchar(16) NOT NULL,
Event varchar(512) NOT NULL,
Count int(10) unsigned NOT NULL,
PRIMARY KEY (DateTime , Node , Event) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE EventLogTmp
Partition by Range(Year(DateTime))
(
Partition OldYearsP Values Less Than(2010),
Partition Y2010P Values Less Than(2011),
Partition Y2011P Values Less Than(2012),
Partition Y2012P Values Less Than(2013),
Partition Y2013P Values Less Than(2014),
Partition Y2014P Values Less Than(2015),
Partition FutYearsP Values Less Than(2050)
);
ALTER TABLE EventLog RENAME TO EventLogTmp3;
ALTER TABLE EventLogTmp RENAME TO EventLog;
INSERT INTO EventLog Select * From EventLogTmp3;
DROP TABLE EventLogTmp3;
If you made a backup of one partition data and this partition can't be used more like this sample that partition table base on year, you can drop the whole partition.
If you made a backup of one partition data and this partition can't be used more like this sample that partition table base on year, you can drop the whole partition.
ALTER TABLE EventLog DROP PARTITION OldYearsP;
If you want to rotate a partition like monthly partition, you can make backup of data and then truncate data inside.
ALTER TABLE EventLog TRUNCATE PARTITION Y2012P;
Saturday, March 3, 2012
SSHd close connection (MaxStartUp)
In case of getting close connection from ssh server and starting multi session concurrently (like a cron job include some session to run command), check and increase the MaxStartUp parameter in /etc/ssh/sshd_config.
Wednesday, February 22, 2012
Apartheid in Parking Lot
I just called to move out my car from my company alley because of my ID card color (RED). Because this is company policy to allow Blue card guys (internals) use the alley and parking of company.
* funny part is that alley is public place and is not for company at all
I really surprised and don't expect it from an international company, headquarter based on one of the socialist Scandinavia.
* funny part is that alley is public place and is not for company at all
I really surprised and don't expect it from an international company, headquarter based on one of the socialist Scandinavia.
Sunday, February 19, 2012
Eye Watching
From "The Art of Photography: An Approach to Personal Expression" by Bruce Barnbaum
With the eye able to see only small bits sharply at any moment, it must move about speedily to view the entire scene. It does not do so in an organized fashion like a TV scanner. Instead, it darts about randomly, up and down, side to side, picking out bits and pieces here and there, and sending these tidbits back to the brain at a furious pace. The brain processes this random data and puts it all together, like a mosaic or a jigsaw puzzle. While studying the scene the eye stops momentarily at prominent objects and sees them with real clarity, filling in the rest in a rather fuzzy manner. Thus, the eye does not perceive the whole scene with uniform sharpness or interest.
With the eye able to see only small bits sharply at any moment, it must move about speedily to view the entire scene. It does not do so in an organized fashion like a TV scanner. Instead, it darts about randomly, up and down, side to side, picking out bits and pieces here and there, and sending these tidbits back to the brain at a furious pace. The brain processes this random data and puts it all together, like a mosaic or a jigsaw puzzle. While studying the scene the eye stops momentarily at prominent objects and sees them with real clarity, filling in the rest in a rather fuzzy manner. Thus, the eye does not perceive the whole scene with uniform sharpness or interest.
Wednesday, October 19, 2011
A Bit of Documentation
Every bit of documentation is worth as much as every line of that code. Document it, even for your Hello World.
God Bless You Dennis
God Bless You Dennis
Sunday, February 27, 2011
Subscribe to:
Posts (Atom)
