Reputation: 11
I have a ~1MB JSON file that needs to be converted to MySQL. The file has close to 400 records. What is the best way to do this using PHP ?
If i try to add 400 records in a single pass, I either get the memory or execution time error. Whats the best way around this ?
Upvotes: 1
Views: 536
Reputation: 4682
Try a multi-stage approach. Use json_decode()
to turn the records into INSERT statements. Then you can use the FILE
command in the mysql client to run all the inserts.
Upvotes: 1