lemmin Posted August 13, 2007 Share Posted August 13, 2007 What would be the most efficient way of storing the posts in a forum? If I store them in the DB with a massive char string, it seems a little bit rediculous. Especially since the size range is huge. Would it make sense to save each post as its own file and read each post to the browser? What is the standard for doing this? Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/64732-solved-most-efficient-forum-db/ Share on other sites More sharing options...
roopurt18 Posted August 13, 2007 Share Posted August 13, 2007 Would it make sense to save each post as its own file and read each post to the browser? No, it wouldn't. What is the standard for doing this? Using a database. Declare the column that is holding the post bodies as TEXT, TINYTEXT, or some other large text field type. Quote Link to comment https://forums.phpfreaks.com/topic/64732-solved-most-efficient-forum-db/#findComment-322839 Share on other sites More sharing options...
lemmin Posted August 13, 2007 Author Share Posted August 13, 2007 So, If I wanted to allow 2^32 characters, maximum, wouldn't that allocate a rediculously unnecessary amount of space for someone posting the responce "Ok, thanks." Or do those data types dynamically set the size? Quote Link to comment https://forums.phpfreaks.com/topic/64732-solved-most-efficient-forum-db/#findComment-322859 Share on other sites More sharing options...
roopurt18 Posted August 13, 2007 Share Posted August 13, 2007 Do you really think anyone is going to type a response that is 2^32 characters in length on a forum? Do you realize how big that is? Let's assume that your keyboard has a key repeat rate of 50 chars per second. That means if I just held down the 'a' key, it'd produce 50 of them per second. Let's figure out how long that'd take to produce 2^32 of the letter 'a'. 2^32 chars / (50 char / s) = 85899345.92s 85899345.92s / 60 / 60 / 24 = 994 days Let's not even worry about the logistics of the user's machine crashing from not having enough memory to hold that many chars in memory at once. Or uploading 2^32 bytes worth of data to the server. You can probably safely create the column of type TEXT, or 2^16 and never have a problem. As for the database engine setting aside large chunks of space for small posts, I wouldn't worry about it. The people who develop and maintain MySQL are more clever than you're giving them credit. Quote Link to comment https://forums.phpfreaks.com/topic/64732-solved-most-efficient-forum-db/#findComment-322880 Share on other sites More sharing options...
lemmin Posted August 13, 2007 Author Share Posted August 13, 2007 My question remains the same had I said 2^16 or 2^64. It was a number. Does anyone know if these large data types are allocated or dynamically created? Quote Link to comment https://forums.phpfreaks.com/topic/64732-solved-most-efficient-forum-db/#findComment-322890 Share on other sites More sharing options...
jvrothjr Posted August 14, 2007 Share Posted August 14, 2007 True Question here would be are you planning on this forum getting larger or staying small. Your talking about using "Flat Files" to run a forum? choose your DB you would like to use as an option and do some research on it For one Mysql has many ways to set up a DB / Tables and and yes some DB's are dynamically others allocated for example MS Access you do have to compress. DB's do require maintenance. Plus if your worried about "Large text" limit the size of the post. but not 2^16 that would be over board. Quote Link to comment https://forums.phpfreaks.com/topic/64732-solved-most-efficient-forum-db/#findComment-323555 Share on other sites More sharing options...
lemmin Posted August 14, 2007 Author Share Posted August 14, 2007 Great, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/64732-solved-most-efficient-forum-db/#findComment-323596 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.