guest2013-1
guest
- Joined
- Aug 22, 2003
- Messages
- 19,800
- Reaction score
- 13
Hi, yay for another stupid mysql question.
I have a table that needs to be normalized. Unfortunately this table contains 7.7 million products.
Now each of them has a manufacturer NAME on the same record. Many of which have the same manufacturers. So in an effort to change the existing database (owner approved finally) and to speed up the search based on manufacturer. I've added a ManufacturerID in the products table, and created a separate consolidated manufacturer table/list.
(Obviously you can see this will improve speed on a search massively since the previous developers never tested on this amount of data before)
My question now is, what is the MOST efficient AND QUICK way to update that table?
All the tables are MyISAM and will stay MyISAM unless you can prove to me InnoDB is superior.
I have a stored routine that has a cursor loop through each product and passes it's ID and manufacturer name through. Then I have an update statement that looks like this:
Anything to help improve would be greatly appreciated. As it looks like this will run for almost 4 days non-stop (and providing no locks occur, which it will) just to update that.
And I have several tables to normalize still.
I have a table that needs to be normalized. Unfortunately this table contains 7.7 million products.
Now each of them has a manufacturer NAME on the same record. Many of which have the same manufacturers. So in an effort to change the existing database (owner approved finally) and to speed up the search based on manufacturer. I've added a ManufacturerID in the products table, and created a separate consolidated manufacturer table/list.
(Obviously you can see this will improve speed on a search massively since the previous developers never tested on this amount of data before)
My question now is, what is the MOST efficient AND QUICK way to update that table?
All the tables are MyISAM and will stay MyISAM unless you can prove to me InnoDB is superior.
I have a stored routine that has a cursor loop through each product and passes it's ID and manufacturer name through. Then I have an update statement that looks like this:
Code:
UPDATE xml_record_product SET ManufacturerID = (select ManufacturerID from ms_tblmanufacturer where ltrim(rtrim(Manufacturer)) = p_Manufacturer)
WHERE product_id = p_ProductID;
Anything to help improve would be greatly appreciated. As it looks like this will run for almost 4 days non-stop (and providing no locks occur, which it will) just to update that.
And I have several tables to normalize still.