jcanker Posted February 28, 2010 Share Posted February 28, 2010 As a general rule, which would be quicker on a routine basis: Having a potentially large multi-dimensional array, some of which keys are loaded as keys in the $_SESSION array; OR Storing those values in the DB in different columns and pulling them up. Imagine, for instance a gradebook where all the individual assignments are kept as keys in one array, each key in that array has an array keeping keys tracking the weighing categories and the grades for each student (studentID as key). Or would it be faster to keep this data separate in the db, perhaps a column for all the grades, students by row. This would also require the assignment info such as date assigned, due date, and weighting category to be kept in a separate table. EXTRA INFO: Ultimately this project will use AJAX as the teacher enters/updates grades. Potentially we're looking at a large number of teachers accessing their own data, so at any point in time let's assume about 1000+ users pulling data, either for gradebook updates or for students/parents viewing student grades.... Quote Link to comment https://forums.phpfreaks.com/topic/193624-which-is-quicker-multid-array-or-mysql-query/ Share on other sites More sharing options...
sasa Posted February 28, 2010 Share Posted February 28, 2010 if you want to save data you must use database, isn't it Quote Link to comment https://forums.phpfreaks.com/topic/193624-which-is-quicker-multid-array-or-mysql-query/#findComment-1019260 Share on other sites More sharing options...
Alias Posted February 28, 2010 Share Posted February 28, 2010 If you've got the computing power available I would say use a database. It keeps things cleaner and makes information easier to access. I would imaging using Multi-Dimensional Arrays would make the php files themselves very large and hard to access the information in the arrays. Quote Link to comment https://forums.phpfreaks.com/topic/193624-which-is-quicker-multid-array-or-mysql-query/#findComment-1019292 Share on other sites More sharing options...
btherl Posted February 28, 2010 Share Posted February 28, 2010 Is this for a single school? 1000+ simultaneous users I would think of as something statewide or nationwide. In any case, you should use a database. I imagine data integrity is more important than efficiency here. Quote Link to comment https://forums.phpfreaks.com/topic/193624-which-is-quicker-multid-array-or-mysql-query/#findComment-1019298 Share on other sites More sharing options...
jcanker Posted February 28, 2010 Author Share Posted February 28, 2010 I should clarify: the arrays would be kept in the database, but all the info would be stored in one db location rather than requiring several different tables and columns info. Keeping it in an array and using variables to reference key names could actually make it easier to access data. Using AJAX, if the array is changed, the array is immediately rewritten back to the db for integrity. Either way there's going to be quite a bit of data flying back and forth--the main question is will it be one large array using RAM and disk writes to the SESSION or many, many variables using RAM and multiple writes to the DB. I guess I'm asking which of those would be more efficient. The data integrity will be there because of the array updates using AJAX at every change. Quote Link to comment https://forums.phpfreaks.com/topic/193624-which-is-quicker-multid-array-or-mysql-query/#findComment-1019381 Share on other sites More sharing options...
btherl Posted March 1, 2010 Share Posted March 1, 2010 I really don't understand what you are suggesting here. How would you store all the information in one database location without using several tables with columns? Quote Link to comment https://forums.phpfreaks.com/topic/193624-which-is-quicker-multid-array-or-mysql-query/#findComment-1019733 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.