MySQL Forums
Forum List  »  InnoDB

Re: taking long time to ALTER the table
Posted by: Rick James
Date: April 14, 2016 12:39PM

I do not have a handle on the "1 minute for 4M rows", but here are some things that should help.

It is generally not a good design to have "arrays" (such as multiple addresses, _01/_02, list of dates, etc) in a single table. It is better to have other tables, with a PRIMARY KEY that is a combination of the Primary key of this table, plus some other indicator. (For the addresses: 'c' vs 'rb'.)

Furthermore, everything(?) is NULL. This may imply that everything is optional. If so, then moving chunks of optional stuff to another table(s) could clean up the structure. Rather than having lots of NULLs in the other table, simply don't have the row. To put things back together, use LEFT JOIN.

There are 13 names.

ps_key vs ps_id ? Sounds redundant?

Curious... Your first output had a few dy_ fields; the CREATE TABLE has none. Probably the dy_ clump should be another table.

ALTERing a narrower/shorter table should be faster.

Options: ReplyQuote

Written By
April 07, 2016 07:47AM
Re: taking long time to ALTER the table
April 14, 2016 12:39PM

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.