Re: space gone after MyISAM REPAIR TABLE

2013-06-26 Thread Jay Ess
On 2013-06-26 18:31, nixofortune wrote:
 What would be the best way to convert BIG MyISAM table into InnoDB? We do not
 have SLAVE.

I would do it on another computer. Then copy the table to the server and then
add the data that has been added from the original table.

And/or i would experiment with TokuDB. I havent had the time to do it myself but
will probably soon. I am too looking for a lengthy 1 billion+ row conversion.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: space gone after MyISAM REPAIR TABLE

2013-06-26 Thread nixofortune

On 25/06/13 23:55, Rick James wrote:

Switch to InnoDB so you won't have to repair after crashes.
Caution:  InnoDB takes 2x-3x the disk space per table.  Be sure to use 
innodb_file_per_table=1.
 Repair by sort. is usually much faster than repair by keycache; you probably got 
'sort' because of this being big enough:  myisam_sort_buffer_size = 526M


-Original Message-
From: nixofortune [mailto:nixofort...@gmail.com]
Sent: Monday, June 24, 2013 12:35 PM
To: mysql@lists.mysql.com
Subject: Re: space gone after MyISAM REPAIR TABLE

On 24/06/13 19:57, Reindl Harald wrote:

Am 24.06.2013 18:47, schrieb Johan De Meersman:

- Original Message -

From: nixofortune nixofort...@gmail.com

Hi guys,
any suggestions? I just repaired 90G MyISAM table with REPAIR TABLE
command. the space on the hard drive gone down from 165 Gig to 70
Gig. I understand that during repair process MySQL creates temp file
and remove it after the job done.  Or removal process executes on
the server restart? how can I get that space back? I can't check the
table directory as I don't have root perm on that box.

Oops... Can you run [show global variables like

'innodb_file_per_table';] ?

I kind of expect it to be OFF, which means that the temp table would

have been created in the main tablespace. If that's the case, that space
has been permanently assimilated by the global tablespace; the only way to
get it back would be a full dump of all your (innodb) tables, stop server,
delete tablespace, start server and import the data again. Be sure to read
the documentation carefully before doing such an intrusive operation.

While you're doing that, use the opportunity to set
innodb_file_per_table to ON :-p

he spoke about MYISAM table


the space on the hard drive gone down from 165 Gig to 70 Gig how can
I get that space back?
I can't check the table directory as I don't have root perm

well, someone should look at the dadadir and error-log it is not
uncommon that a repair to such large tables fails due too small
myisam_sort_buffer_size and i suspect the operation failed and some
temp file is laying around


Thanks Reindl, It looks like Repair operation completed successfully.
Overall it took 2Hours to complete with OK massage and some other message
related to the index size. Repair process went through Repair by sort.
myisam_sort_buffer_size = 526M.
Provider runs MySQL on FreeBSD + ZFS file system. Could it be up to
snapshots as well?
I will ask them to look inside of datadir as we migrated this DB from
Solaris just day before. This is a new DB for me and I never worked with
MyISAM tables of that size.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql

Hi Rick,
many thanks for the 2x3 space tip. I'm working on that trying to find a 
way by reducing extremely inefficient tables.
Switched to innodb_file_per_table already. I'm gradually converting HUGE 
(70-100Gig) MyISAM tables to InnoDB.

The way I do it is by
1. creating csv file to keep the original data
2. CREATE TABLE new_innodb LIKE old_myisam;
3. ALTER TABLE new_innodb MODIFY ADD id bigint UNSIGNED AUTO_INCREMENT 
PRIMARY KEY FIRST; (YES NO PRIMARY KEYS :(  )

4. LOAD DATA INFILE '/storage/mysql/dump/old_myisam.csv'
INTO TABLE new_innodb
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY ''
LINES TERMINATED BY '\n'
(`site_id`,`index_date`,`index_month`,`index_year`,`keyword`,`source`,`visits`,`bounced_visits`,`transactions`,`revenue`,`value_per_click`,`conversions`,`goal_value`);

Our operations allows to do that. But it takes a long time to load 7-8 H 
for 250 000 000 Rows
I tried to DROP indexes on  new_innodb, LOAD DATA, works  quicker, but 
then when I do

ALTER TABLE `new_innodb`
ADD KEY `idx1` (`col1`,`col2`),
ADD  KEY `idx2` (`col1`,`col2`,`col3`);

Server become numb with I/O wait 15-20% and I had to kill the process ..

What would be the best way to convert BIG MyISAM table into InnoDB? We 
do not have SLAVE.


Thanks,
Igor

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: space gone after MyISAM REPAIR TABLE

2013-06-26 Thread Johan De Meersman
You can't actually move innodb tables around until 5.6 where you have 
transpotable tablespaces.

I suggest having a good hard look at pt-online-schema-change or whatsitcalled.

Jay Ess li...@netrogenic.com wrote:
On 2013-06-26 18:31, nixofortune wrote:
 What would be the best way to convert BIG MyISAM table into InnoDB?
We do not
 have SLAVE.

I would do it on another computer. Then copy the table to the server
and then
add the data that has been added from the original table.

And/or i would experiment with TokuDB. I havent had the time to do it
myself but
will probably soon. I am too looking for a lengthy 1 billion+ row
conversion.

-- 
Sent from Kaiten Mail. Please excuse my brevity.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



NOW() is stuck...

2013-06-26 Thread Andy Wallace

We've been having some issues with one of our MySQL servers lately, and 
currently
the dang thing is stuck. For at least the last hour, NOW() is returning the 
same
value:

mysql select now();
+-+
| now()   |
+-+
| 2013-06-26 02:27:14 |
+-+

The system variable timestamp also has that same time value stored in it. How
can we kick this loose so that the values are more current with real time? (it 
is
currently 3:08PM here, despite our MySQL instance thinking it's 2am. The system
time on the machine is correct:

$ date
Wed Jun 26 15:08:56 PDT 2013


This is MySQL 5.1.46 running on solaris2.10.

Any ideas short of restarting the MySQL engine? I'm willing to do that, but 
would much
rather wait and not do it in the middle of the day.

Thanks,
Andy


--
Andy Wallace
iHOUSEweb, Inc.
awall...@ihouseweb.com
(866) 645-7700 ext 219
--
Sometimes it pays to stay in bed on Monday, rather than spending the rest of the 
week debugging Monday's code.
- Christopher Thompson

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: space gone after MyISAM REPAIR TABLE

2013-06-26 Thread hsv
 2013/06/26 17:31 +0100, nixofortune 
ALTER TABLE `new_innodb`
ADD KEY `idx1` (`col1`,`col2`),
ADD  KEY `idx2` (`col1`,`col2`,`col3`);

Is it really seemly for one index to be a leading part of another?
(or maybe I am really thinking of something else)


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



RE: NOW() is stuck...

2013-06-26 Thread Rick James
Submit a bug:
http://bugs.mysql.com
Alas, you probably cannot provide a reproducible test case.  Still, someone 
might start at the code and discover a possible cause.

 -Original Message-
 From: Andy Wallace [mailto:awall...@ihouseweb.com]
 Sent: Wednesday, June 26, 2013 3:10 PM
 To: mysql list
 Subject: NOW() is stuck...
 
 We've been having some issues with one of our MySQL servers lately, and
 currently the dang thing is stuck. For at least the last hour, NOW() is
 returning the same
 value:
 
 mysql select now();
 +-+
 | now()   |
 +-+
 | 2013-06-26 02:27:14 |
 +-+
 
 The system variable timestamp also has that same time value stored in
 it. How can we kick this loose so that the values are more current with
 real time? (it is currently 3:08PM here, despite our MySQL instance
 thinking it's 2am. The system time on the machine is correct:
 
 $ date
 Wed Jun 26 15:08:56 PDT 2013
 
 
 This is MySQL 5.1.46 running on solaris2.10.
 
 Any ideas short of restarting the MySQL engine? I'm willing to do that,
 but would much rather wait and not do it in the middle of the day.
 
 Thanks,
 Andy
 
 
 --
 Andy Wallace
 iHOUSEweb, Inc.
 awall...@ihouseweb.com
 (866) 645-7700 ext 219
 --
 Sometimes it pays to stay in bed on Monday, rather than spending the rest
 of the week debugging Monday's code.
 - Christopher Thompson
 
 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: space gone after MyISAM REPAIR TABLE

2013-06-26 Thread nixofortune

This is my table:
CREATE TABLE `ga_monthly_keyword_visits` (
  `site_id` int(11) DEFAULT NULL,
  `index_date` int(11) DEFAULT NULL,
  `index_month` int(11) NOT NULL,
  `index_year` int(11) NOT NULL,
  `keyword` varchar(128) DEFAULT NULL,
  `source` varchar(30) DEFAULT NULL,
  `visits` int(11) DEFAULT NULL,
  `bounced_visits` int(11) DEFAULT NULL,
  `transactions` int(11) DEFAULT NULL,
  `revenue` float(10,2) DEFAULT NULL,
  `value_per_click` float(10,2) DEFAULT NULL,
  `conversions` int(11) DEFAULT NULL,
  `goal_value` float(10,2) DEFAULT NULL,
  KEY `idx_bounced_visits` (`site_id`,`index_date`),
  KEY `idx_visits_month` (`site_id`,`keyword`,`index_month`,`index_year`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

Was changed into:

CREATE TABLE `ga_monthly_keyword_visits` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `site_id` int(11) DEFAULT NULL,
  `index_date` int(11) DEFAULT NULL,
  `index_month` int(11) NOT NULL,
  `index_year` int(11) NOT NULL,
  `keyword` varchar(128) DEFAULT NULL,
  `source` varchar(30) DEFAULT NULL,
  `visits` int(11) DEFAULT NULL,
  `bounced_visits` int(11) DEFAULT NULL,
  `transactions` int(11) DEFAULT NULL,
  `revenue` float(10,2) DEFAULT NULL,
  `value_per_click` float(10,2) DEFAULT NULL,
  `conversions` int(11) DEFAULT NULL,
  `goal_value` float(10,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
  KEY `idx_bounced_visits` (`site_id`,`index_date`),
  KEY `idx_visits_month` (`site_id`,`keyword`,`index_month`,`index_year`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

I tried Converting like this:

   CREATE TABLE new LIKE old;
   ALTER TABLE new DROP (all indexes), ADD PRIMARY KEY (either autoincrement or 
a 'natural' compound PK), ENGINE=InnoDB;
   INSERT INTO new SELECT site_id, ..., goal_value FROM old;
   ALTER TABLE new ADD INDEX (...);

With only difference The original MyISAM table crashed and I took it 
from backup, loading by LOAD DATA INFILE.
The problem, yes It loaded much quicker into Database 4H 16M to be 
precise, but ALTER TABLE new ADD INDEX (...);
Put server into meditation mode. High I/O Wait rendered box unusable. I 
had to interrupt the ALTER ADD KEY process after 5H of struggle.


Now importing with Keys in place. It takes longer, much longer but at 
least the server is working and customers do not complaint.
Schema design is awful, agree. I try to understand the process so will 
redesign it soon, but any suggestions are welcome.

I' not a MySQL super guru so will be glad for hear your sorts, guys.
Thanks


On 27/06/13 00:04, Rick James wrote:

(`site_id`,`index_date`,`index_month`,`index_year`,`keyword`,`source`,`visits`, 
`bounced_visits`,`transactions`,`revenue`,`value_per_click`,`conversions`,`goal_value`);

May we see the SHOW CREATE TABLE?  Some of this smells bad.
* It is almost always bad to split day/month/year into multiple fields.
* Often a fact table, which this sounds like, should not have extra indexes.
* Is each datatype as small as is practical?
* Are any of the fields VARCHAR, and could be 'normalized'?

I would expect this to the fastest way to convert (assuming you have the disk 
space):
CREATE TABLE new LIKE old;
ALTER TABLE new DROP (all indexes), ADD PRIMARY KEY (either autoincrement 
or a 'natural' compound PK), ENGINE=InnoDB;
INSERT INTO new SELECT site_id, ..., goal_value FROM old;
ALTER TABLE new ADD INDEX (...);

What version of MySQL are you running?  Newer versions do the ALTER TABLE 
faster (online??), and may require you to do one add at a time.

Another issue...
If the data in `old` is in the same order as the PRIMARY KEY of `new`, then 
INSERT..SELECT will run fast.  (No need to jump around to find where to put 
each row.)
Case 1:  You are adding an AUTO_INC -- it will be in the 'right' order.
Case 2:  The new PK is approximately the order of the insertions into `old` -- 
probably run fast.  (However, I do not see a likely natural PK that would allow 
this

INSERT ... SELECT...ORDER BY (new PK) -- This would make the INSERT part fast, but the 
SELECT part would be slow.  (You can't win)

Your task is all about disk hits.  By understanding what MySQL has to do, you can 'predict' whether 
a plan will be slow or slower.

Back to the secondary indexes...
What are the SELECTs that will benefit from them?  (Sometimes discussing this 
can lead to fewer/better INDEXes.  Often it leads to suggesting Summary 
Table(s).)



-Original Message-
From: Johan De Meersman [mailto:vegiv...@tuxera.be]
Sent: Wednesday, June 26, 2013 11:46 AM
To: li...@netrogenic.com; Jay Ess; mysql@lists.mysql.com
Subject: Re: space gone after MyISAM REPAIR TABLE

You can't actually move innodb tables around until 5.6 where you have
transpotable tablespaces.

I suggest having a good hard look at pt-online-schema-change or
whatsitcalled.

Jay Ess li...@netrogenic.com wrote:

On 2013-06-26 18:31, nixofortune wrote:

What would be the best way to convert BIG MyISAM table into InnoDB?

We do not

have SLAVE.

I would do it on another computer. Then 

RE: space gone after MyISAM REPAIR TABLE

2013-06-26 Thread Rick James
 (`site_id`,`index_date`,`index_month`,`index_year`,`keyword`,`source`,`visits`,
  
 `bounced_visits`,`transactions`,`revenue`,`value_per_click`,`conversions`,`goal_value`);

May we see the SHOW CREATE TABLE?  Some of this smells bad.
* It is almost always bad to split day/month/year into multiple fields.
* Often a fact table, which this sounds like, should not have extra indexes.
* Is each datatype as small as is practical?
* Are any of the fields VARCHAR, and could be 'normalized'?

I would expect this to the fastest way to convert (assuming you have the disk 
space):
   CREATE TABLE new LIKE old;
   ALTER TABLE new DROP (all indexes), ADD PRIMARY KEY (either autoincrement or 
a 'natural' compound PK), ENGINE=InnoDB;
   INSERT INTO new SELECT site_id, ..., goal_value FROM old;
   ALTER TABLE new ADD INDEX (...);

What version of MySQL are you running?  Newer versions do the ALTER TABLE 
faster (online??), and may require you to do one add at a time.

Another issue...
If the data in `old` is in the same order as the PRIMARY KEY of `new`, then 
INSERT..SELECT will run fast.  (No need to jump around to find where to put 
each row.)
Case 1:  You are adding an AUTO_INC -- it will be in the 'right' order.
Case 2:  The new PK is approximately the order of the insertions into `old` -- 
probably run fast.  (However, I do not see a likely natural PK that would allow 
this

INSERT ... SELECT...ORDER BY (new PK) -- This would make the INSERT part fast, 
but the SELECT part would be slow.  (You can't win)

Your task is all about disk hits.  By understanding what MySQL has to do, you 
can 'predict' whether a plan will be slow or slower.

Back to the secondary indexes...
What are the SELECTs that will benefit from them?  (Sometimes discussing this 
can lead to fewer/better INDEXes.  Often it leads to suggesting Summary 
Table(s).)


 -Original Message-
 From: Johan De Meersman [mailto:vegiv...@tuxera.be]
 Sent: Wednesday, June 26, 2013 11:46 AM
 To: li...@netrogenic.com; Jay Ess; mysql@lists.mysql.com
 Subject: Re: space gone after MyISAM REPAIR TABLE
 
 You can't actually move innodb tables around until 5.6 where you have
 transpotable tablespaces.
 
 I suggest having a good hard look at pt-online-schema-change or
 whatsitcalled.
 
 Jay Ess li...@netrogenic.com wrote:
 On 2013-06-26 18:31, nixofortune wrote:
  What would be the best way to convert BIG MyISAM table into InnoDB?
 We do not
  have SLAVE.
 
 I would do it on another computer. Then copy the table to the server
 and then add the data that has been added from the original table.
 
 And/or i would experiment with TokuDB. I havent had the time to do it
 myself but will probably soon. I am too looking for a lengthy 1
 billion+ row conversion.
 
 --
 Sent from Kaiten Mail. Please excuse my brevity.
 
 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql



Re: NOW() is stuck...

2013-06-26 Thread John Meyer
Well, if you want to get unstuck in time, maybe you need to call Billy 
Pilgrim ;-)

Andy Wallace wrote:
We've been having some issues with one of our MySQL servers lately, 
and currently
the dang thing is stuck. For at least the last hour, NOW() is 
returning the same

value:

mysql select now();
+-+
| now()   |
+-+
| 2013-06-26 02:27:14 |
+-+

The system variable timestamp also has that same time value stored 
in it. How
can we kick this loose so that the values are more current with real 
time? (it is
currently 3:08PM here, despite our MySQL instance thinking it's 2am. 
The system

time on the machine is correct:

$ date
Wed Jun 26 15:08:56 PDT 2013


This is MySQL 5.1.46 running on solaris2.10.

Any ideas short of restarting the MySQL engine? I'm willing to do 
that, but would much

rather wait and not do it in the middle of the day.

Thanks,
Andy





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: space gone after MyISAM REPAIR TABLE

2013-06-26 Thread Jay Ess

On 2013-06-27 01:27, nixofortune wrote:
Now importing with Keys in place. It takes longer, much longer but at 
least the server is working and customers do not complaint.
Schema design is awful, agree. I try to understand the process so will 
redesign it soon, but any suggestions are welcome.

I' not a MySQL super guru so will be glad for hear your sorts, guys.
Thanks
You could probably reduce your table size a LOT by breaking out 
keyword and source to their own tables and reference them.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: NOW() is stuck...

2013-06-26 Thread Eric Bergen
This is the expected behavior if you set the timestamp variable in
your session. This is the same mechanism that replication uses to
execute transactions on the slave with the correct time. Setting
timestamp back to default or reopening your connection will fix it.

MariaDB [(none)] set timestamp=1372296737;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)] select now(); select sleep(5); select now();
+-+
| now()   |
+-+
| 2013-06-26 21:32:17 |
+-+
1 row in set (0.00 sec)

+--+
| sleep(5) |
+--+
|0 |
+--+
1 row in set (5.00 sec)

+-+
| now()   |
+-+
| 2013-06-26 21:32:17 |
+-+
1 row in set (0.00 sec)

MariaDB [(none)] set timestamp=default;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)] select now();
+-+
| now()   |
+-+
| 2013-06-26 21:33:53 |
+-+
1 row in set (0.00 sec)

MariaDB [(none)] select now();
+-+
| now()   |
+-+
| 2013-06-26 21:33:54 |
+-+
1 row in set (0.00 sec)

On Wed, Jun 26, 2013 at 4:18 PM, John Meyer
johnme...@pueblocomputing.com wrote:
 Well, if you want to get unstuck in time, maybe you need to call Billy
 Pilgrim ;-)

 Andy Wallace wrote:

 We've been having some issues with one of our MySQL servers lately, and
 currently
 the dang thing is stuck. For at least the last hour, NOW() is returning
 the same
 value:

 mysql select now();
 +-+
 | now()   |
 +-+
 | 2013-06-26 02:27:14 |
 +-+

 The system variable timestamp also has that same time value stored in
 it. How
 can we kick this loose so that the values are more current with real time?
 (it is
 currently 3:08PM here, despite our MySQL instance thinking it's 2am. The
 system
 time on the machine is correct:

 $ date
 Wed Jun 26 15:08:56 PDT 2013


 This is MySQL 5.1.46 running on solaris2.10.

 Any ideas short of restarting the MySQL engine? I'm willing to do that,
 but would much
 rather wait and not do it in the middle of the day.

 Thanks,
 Andy




 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql




-- 
Eric Bergen
eric.ber...@gmail.com
http://www.ebergen.net

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: space gone after MyISAM REPAIR TABLE

2013-06-26 Thread Divesh Kamra
You can use disable Key before loading data  use enable Key  after loading 

Command :- alter table {table. Name } disable key;

Same enabling 

DK Sent from Phone

On 27-Jun-2013, at 4:57, nixofortune nixofort...@gmail.com wrote:

 This is my table:
 CREATE TABLE `ga_monthly_keyword_visits` (
  `site_id` int(11) DEFAULT NULL,
  `index_date` int(11) DEFAULT NULL,
  `index_month` int(11) NOT NULL,
  `index_year` int(11) NOT NULL,
  `keyword` varchar(128) DEFAULT NULL,
  `source` varchar(30) DEFAULT NULL,
  `visits` int(11) DEFAULT NULL,
  `bounced_visits` int(11) DEFAULT NULL,
  `transactions` int(11) DEFAULT NULL,
  `revenue` float(10,2) DEFAULT NULL,
  `value_per_click` float(10,2) DEFAULT NULL,
  `conversions` int(11) DEFAULT NULL,
  `goal_value` float(10,2) DEFAULT NULL,
  KEY `idx_bounced_visits` (`site_id`,`index_date`),
  KEY `idx_visits_month` (`site_id`,`keyword`,`index_month`,`index_year`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
 
 Was changed into:
 
 CREATE TABLE `ga_monthly_keyword_visits` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `site_id` int(11) DEFAULT NULL,
  `index_date` int(11) DEFAULT NULL,
  `index_month` int(11) NOT NULL,
  `index_year` int(11) NOT NULL,
  `keyword` varchar(128) DEFAULT NULL,
  `source` varchar(30) DEFAULT NULL,
  `visits` int(11) DEFAULT NULL,
  `bounced_visits` int(11) DEFAULT NULL,
  `transactions` int(11) DEFAULT NULL,
  `revenue` float(10,2) DEFAULT NULL,
  `value_per_click` float(10,2) DEFAULT NULL,
  `conversions` int(11) DEFAULT NULL,
  `goal_value` float(10,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
  KEY `idx_bounced_visits` (`site_id`,`index_date`),
  KEY `idx_visits_month` (`site_id`,`keyword`,`index_month`,`index_year`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
 
 I tried Converting like this:
 
   CREATE TABLE new LIKE old;
   ALTER TABLE new DROP (all indexes), ADD PRIMARY KEY (either autoincrement 
 or a 'natural' compound PK), ENGINE=InnoDB;
   INSERT INTO new SELECT site_id, ..., goal_value FROM old;
   ALTER TABLE new ADD INDEX (...);
 
 With only difference The original MyISAM table crashed and I took it from 
 backup, loading by LOAD DATA INFILE.
 The problem, yes It loaded much quicker into Database 4H 16M to be precise, 
 but ALTER TABLE new ADD INDEX (...);
 Put server into meditation mode. High I/O Wait rendered box unusable. I had 
 to interrupt the ALTER ADD KEY process after 5H of struggle.
 
 Now importing with Keys in place. It takes longer, much longer but at least 
 the server is working and customers do not complaint.
 Schema design is awful, agree. I try to understand the process so will 
 redesign it soon, but any suggestions are welcome.
 I' not a MySQL super guru so will be glad for hear your sorts, guys.
 Thanks
 
 
 On 27/06/13 00:04, Rick James wrote:
 (`site_id`,`index_date`,`index_month`,`index_year`,`keyword`,`source`,`visits`,
  
 `bounced_visits`,`transactions`,`revenue`,`value_per_click`,`conversions`,`goal_value`);
 May we see the SHOW CREATE TABLE?  Some of this smells bad.
 * It is almost always bad to split day/month/year into multiple fields.
 * Often a fact table, which this sounds like, should not have extra 
 indexes.
 * Is each datatype as small as is practical?
 * Are any of the fields VARCHAR, and could be 'normalized'?
 
 I would expect this to the fastest way to convert (assuming you have the 
 disk space):
CREATE TABLE new LIKE old;
ALTER TABLE new DROP (all indexes), ADD PRIMARY KEY (either autoincrement 
 or a 'natural' compound PK), ENGINE=InnoDB;
INSERT INTO new SELECT site_id, ..., goal_value FROM old;
ALTER TABLE new ADD INDEX (...);
 
 What version of MySQL are you running?  Newer versions do the ALTER TABLE 
 faster (online??), and may require you to do one add at a time.
 
 Another issue...
 If the data in `old` is in the same order as the PRIMARY KEY of `new`, then 
 INSERT..SELECT will run fast.  (No need to jump around to find where to put 
 each row.)
 Case 1:  You are adding an AUTO_INC -- it will be in the 'right' order.
 Case 2:  The new PK is approximately the order of the insertions into `old` 
 -- probably run fast.  (However, I do not see a likely natural PK that would 
 allow this
 
 INSERT ... SELECT...ORDER BY (new PK) -- This would make the INSERT part 
 fast, but the SELECT part would be slow.  (You can't win)
 
 Your task is all about disk hits.  By understanding what MySQL has to do, 
 you can 'predict' whether a plan will be slow or slower.
 
 Back to the secondary indexes...
 What are the SELECTs that will benefit from them?  (Sometimes discussing 
 this can lead to fewer/better INDEXes.  Often it leads to suggesting Summary 
 Table(s).)
 
 
 -Original Message-
 From: Johan De Meersman [mailto:vegiv...@tuxera.be]
 Sent: Wednesday, June 26, 2013 11:46 AM
 To: li...@netrogenic.com; Jay Ess; mysql@lists.mysql.com
 Subject: Re: space gone after MyISAM REPAIR TABLE
 
 You can't actually move innodb tables around until 5.6 where you have
 transpotable