Moodle

Feedback database structure

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.3
  • Fix Version/s: None
  • Component/s: Feedback
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

I am worried about the database structure of the feedback module.
All options of questions are stored in one text field (mdl_feedback_item/presentation, separated by a pipe character.

This means that for generating a page with questions, Moodle has to search through the text fields for those pipes, which is putting a lot of stress on the database.

On a unloaded, dual core Xeon machine, generating a page with 54 questions with a lot of text in the answers takes 3 seconds. On heavy load it is a lot longer.

I suggest to set up another tabel for the questions with one record per answer.

Activity

Hide
Andreas Grabs added a comment -

Hi Koen,

You are right, the database-structure is not well formed. But all questions are included as plugin. All questions use the same tables. There is no mechanism to install or deinstall question-related tables.
The field what you mean is only the presentation of the question. On multichoice questions there are the options for the answers on textfield questions there is the definition of the textfield-properties and so on.

Also I can not reproduce your measurement. The following things I tested:

1. Wih a for()-loop I created a textline with 50 elements seperated by a pipe (|).
2. With a second for()-loop I created an array with 1000 elements of these created lines.
3. Now I went through this array with a foreach()-loop and used the explode()-function to extract all elements

There are 1000 explodes with 50 elements (I don't know any questionnaire with so many questions/options)
My script was needing 0.45 seconds. I tested on a VMWare-machine with a Core2Quad 2,83GHz.

Andreas

Show
Andreas Grabs added a comment - Hi Koen, You are right, the database-structure is not well formed. But all questions are included as plugin. All questions use the same tables. There is no mechanism to install or deinstall question-related tables. The field what you mean is only the presentation of the question. On multichoice questions there are the options for the answers on textfield questions there is the definition of the textfield-properties and so on. Also I can not reproduce your measurement. The following things I tested: 1. Wih a for()-loop I created a textline with 50 elements seperated by a pipe (|). 2. With a second for()-loop I created an array with 1000 elements of these created lines. 3. Now I went through this array with a foreach()-loop and used the explode()-function to extract all elements There are 1000 explodes with 50 elements (I don't know any questionnaire with so many questions/options) My script was needing 0.45 seconds. I tested on a VMWare-machine with a Core2Quad 2,83GHz. Andreas
Hide
Eloy Lafuente (stronk7) added a comment -

Hi Andreas,

I think that getting 54 records from DB (containing text columns) shouldn't be heavy. So initially, I'm with you about that storage not being a problem (for questions definition, no for answers at all).

Anyway... could you repeat your tests with the point 1) above being DB records instead of PHP textlines? And measure that? Just to be sure it isn't the DB retrieval the one slowing/loading server a lot.

TIA!

Show
Eloy Lafuente (stronk7) added a comment - Hi Andreas, I think that getting 54 records from DB (containing text columns) shouldn't be heavy. So initially, I'm with you about that storage not being a problem (for questions definition, no for answers at all). Anyway... could you repeat your tests with the point 1) above being DB records instead of PHP textlines? And measure that? Just to be sure it isn't the DB retrieval the one slowing/loading server a lot. TIA!

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated: