Jump to content

Recommended Posts

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....

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.

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.