shinigaimi Posted June 29, 2013 Share Posted June 29, 2013 Hey all I am inserting data into MySQL what would be the best way to do this for example this structure stat_name: "assist_count", value_daily: "9", value_forever: "6445", value_monthly: "349", value_one_life_max: "27", value_weekly: "203" I can separate them in MySQL via , and use explode function to break it up is there a more efficient way to store the data ? I am importing the data from json Quote Link to comment https://forums.phpfreaks.com/topic/279692-inserting-data-into-mysql-efficiently/ Share on other sites More sharing options...
ginerjm Posted June 29, 2013 Share Posted June 29, 2013 Not sure what you are asking. Are you proposing to make a comma-separated string and inserting all the data into one column of a table? Quote Link to comment https://forums.phpfreaks.com/topic/279692-inserting-data-into-mysql-efficiently/#findComment-1438524 Share on other sites More sharing options...
shinigaimi Posted June 29, 2013 Author Share Posted June 29, 2013 (edited) yeah something like $value,$value,$value,$value,$value Edited June 29, 2013 by shinigaimi Quote Link to comment https://forums.phpfreaks.com/topic/279692-inserting-data-into-mysql-efficiently/#findComment-1438525 Share on other sites More sharing options...
ginerjm Posted June 29, 2013 Share Posted June 29, 2013 Allow me to vent: Why would you EVER want to do that? Done. Databases/tables are meant to store data in a meaningful and easily retrievable way. MySQL is a pretty efficient db. Of course you should create a column for each piece of data and store the data pieces in those columns. If you did this thing you propose, how would you ever locate specific items of information without pulling down ALL the rows, exploding each of them and searching through the resulting arrays. That doesn't sound very efficient does it? Quote Link to comment https://forums.phpfreaks.com/topic/279692-inserting-data-into-mysql-efficiently/#findComment-1438528 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.