Move on new table, optimization of my scrips
Hi! :-)
How can I optimize this event, please?
I use this script in a log server. The table have approximately 10,000,000 records for day.
DELIMITER $$
CREATE
EVENT `new_table_log`
ON SCHEDULE EVERY 1 HOUR STARTS '2014-01-01 00:00:00'
DO BEGIN
SET @tablename = 'log';
SELECT @query1 := CONCAT( ' CREATE TABLE tmp LIKE `', @tablename , '` ');
SELECT @query2 := CONCAT( ' RENAME TABLE `', @tablename , '` TO `', @tablename, '_', NOW( ) , '` ' ) ;
SELECT @query3 := CONCAT( ' RENAME TABLE tmp TO `', @tablename , '` ');
PREPARE Q1 FROM @query1;
PREPARE Q2 FROM @query2;
PREPARE Q3 FROM @query3;
EXECUTE Q1;
EXECUTE Q2;
EXECUTE Q3;
END $$
DELIMITER ;
Regards :-)
Subject
Views
Written By
Posted
Move on new table, optimization of my scrips
2553
July 20, 2014 05:53AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.