Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- Writing to normalised database


wrightee - 10:27 am on Nov 4, 2011 (gmt 0)


Got it:

1: Load CSV into tmp table with extra columns for normalisation (e.g. keyword_id,campaign_id)

2: INSERT IGNORE INTO tbl_keywords (keyword) SELECT DISTINCT (keyword) FROM tmp

3: UPDATE tmp.keyword_id SET keyword_id= (SELECT.. etc)

And finally populate tbl_performance with new data in tmp, using normalised columns instead of raw data and truncate the tmp table.

All seems to work very fast.


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4382905.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com