mga_ka_php Posted February 25, 2010 Share Posted February 25, 2010 which is better to have create a 92 table columns or concatenate the values with delimiter and save it into 1 column (longtext)? which is faster to retrieve data from database example 1 column in longtext IdNumber:123[delimiter]Description:the quick brown fox[delimiter]LongDescription: .......... or i will separate that into 92 columns. Quote Link to comment https://forums.phpfreaks.com/topic/193316-92-columns-or-1-longtext/ Share on other sites More sharing options...
trq Posted February 25, 2010 Share Posted February 25, 2010 Having all the data in one field will inhabit your ability to query on specific data. You might not need 92 separate fields either if you normalize your data somewhat. Quote Link to comment https://forums.phpfreaks.com/topic/193316-92-columns-or-1-longtext/#findComment-1017868 Share on other sites More sharing options...
mga_ka_php Posted February 25, 2010 Author Share Posted February 25, 2010 so what is the best solution? Quote Link to comment https://forums.phpfreaks.com/topic/193316-92-columns-or-1-longtext/#findComment-1017875 Share on other sites More sharing options...
trq Posted February 25, 2010 Share Posted February 25, 2010 Well, I would never store data in one long delimited string in a database. You loose too much of the flexibility that comes with using a database. Quote Link to comment https://forums.phpfreaks.com/topic/193316-92-columns-or-1-longtext/#findComment-1017893 Share on other sites More sharing options...
mga_ka_php Posted February 25, 2010 Author Share Posted February 25, 2010 then what is the best solution? this is a big database. i want to optimize the database of our site because our server load is very high, it makes the site slow. i'm trying to optimize also the web pages. Quote Link to comment https://forums.phpfreaks.com/topic/193316-92-columns-or-1-longtext/#findComment-1018020 Share on other sites More sharing options...
PFMaBiSmAd Posted February 25, 2010 Share Posted February 25, 2010 Your example implies the need for three columns. Without specific information about what the data is and how it is used, we cannot directly help you. The solution might range from a single table with some of the data in discrete columns and some of it stored as a list in one column all the way to some of the data separated out into separate tables. Quote Link to comment https://forums.phpfreaks.com/topic/193316-92-columns-or-1-longtext/#findComment-1018022 Share on other sites More sharing options...
fenway Posted February 25, 2010 Share Posted February 25, 2010 Sounds like you need an EAV table. Quote Link to comment https://forums.phpfreaks.com/topic/193316-92-columns-or-1-longtext/#findComment-1018262 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.