Issue Details (XML | Word | Printable)

Key: MDL-19584
Type: Bug Bug
Status: Open Open
Priority: Critical Critical
Assignee: moodle.com
Reporter: Generazion Consulting S.L.
Votes: 6
Watchers: 9
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Query multiple, overflowing database platform

Created: 22/Jun/09 06:01 PM   Updated: 22/Oct/09 04:32 PM
Return to search
Component/s: Database activity module
Affects Version/s: 1.9.5
Fix Version/s: None

Environment:
PHP Version 5.1.6
Mysql 5.0.45
Linux Red Hat 4.1.2-44
Issue Links:
Blockers
 

Database: MySQL
Participants: Generazion Consulting S.L., Hubert Chathi, Jean FRUITET, moodle.com and T. Nuin
Security Level: None
Difficulty: Moderate
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
We have a problem with the following Moodle module "Database":

"/mod/data/view.php?d=122&mode=asearch"

In certain cases, Moodle tries to execute a query on a course and the Mysql database gets collapsed.

This is the mumber of records from the tables of our database:

mdl_data_content ? 7300 records
mdl_data_records ? 1200 records
mdl_user ? 7200 records

This is one of the Mysql queries, which causes the problem:

This query generates the following "Cartesian Product" which causes the database to hang:

SELECT COUNT(DISTINCT c.recordid)
FROM mdl_data_content c,
mdl_data_records r,
mdl_data_content cs,
mdl_user u ,
mdl_data_content c375 ,
mdl_data_content c376 ,
mdl_data_content c377 ,
mdl_data_content c378

WHERE c.recordid = r.id
AND r.dataid = 105
AND r.userid = u.id
AND cs.recordid = r.id
AND c375.recordid = r.id
AND c376.recordid = r.id
AND c377.recordid = r.id
AND c378.recordid = r.id;

We expect your help for our problem, thank you very much in advance.

Greetings.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
T. Nuin added a comment - 25/Aug/09 06:04 PM
Hi,

I'm the programmer at the University of Bath working on Moodle. We have experienced the same problem. I wanted to know if anyone is currently looking at this? If not, or if this is in limbo, then I'll resolve this, hopefully I can allocate time next week. This is a serious problem as these queries have actually managed to bring our entire Moodle system down when a student runs a more complicated search in the Database Module.

So before I get stuck in and potentially duplicate effort, has anyone else made a start on this?

Thanks,

Taliesin Nuin.


Jean FRUITET added a comment - 04/Sep/09 11:15 PM
In that script ./mod/data/view.php
Remove all
mdl_data_content cs,
and
AND cs.recordid = r.id
and replace all SQL clause
$searchselect = " AND (cs.content
by
$searchselect = " AND (c.content

and that's all


Hubert Chathi added a comment - 18/Sep/09 04:41 AM
This seems to be the same bug as MDL-17327. Can you try copying mod/data/view.php from the latest weekly stable release, and see if it fixes the issue?

Generazion Consulting S.L. added a comment - 22/Oct/09 04:32 PM
Thanks Hubert Chathi, we have solved the problem with your advice. Friends is working properly.