Adsense
Popular Posts
- MySQL workbench -"Could not decrypt password cache"
- peer review (3)
- PHP, dump varailbes in a format way
- "Unusual traffic from your computer network" from blogger
- Install APXS in Redhat Linux
- JavaScript, remove trailing insignificant zeros after toFixed function
- Update member directory
- Set Windows path command line
- JavaScript: add days to current date
- DataTable table order by numeric, not by text
Friday, November 29, 2013
Reviewer bug in research portal
When admin assign himself as reviewer, view_project.php hanged.
This is due to that
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\research\projects\view_project.php
line49
$reviewer = get_reviewer($_SESSION['member_id']);
call get_reviewers function in
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\research\_lib\projects\reviewer_tools.inc.php
get_reviewers function is very complicated to make system hanged.
Solution:
1. Reduce research database.
2. CESEI PHP error log need to be cleaned often
C:\php5.3.1\error.log, around 9GB. Difficult to open and write.
3. Think about new algorithm to write function
get_reviewers
Use $start=microtime(true); $end=microtime(true);
$end-start to get processing time in seconds in get_reviewers function.
or try
echo date('h:i:s') . "\n";
to see time difference.
Find
$sql = "SELECT subject_id,study_code,active,reminders FROM subjects WHERE subject_id IN(
SELECT subject_id FROM review_slot_subjects WHERE review_slot_id
IN (SELECT review_slot_id FROM review_slots WHERE project_id=$pid AND review_slot_id
IN (SELECT review_slot_id FROM review_slot_reviewers WHERE member_id=$rid))) ORDER BY study_code";
$result = mysql_query($sql, $db);
take about 2 minutes.
change the statement into two steps:
//step 1
$sql = "SELECT subject_id FROM review_slot_subjects WHERE review_slot_id
IN (SELECT review_slot_id FROM review_slots WHERE project_id=$pid AND review_slot_id
IN (SELECT review_slot_id FROM review_slot_reviewers WHERE member_id=$rid))";
$result = mysql_query($sql, $db);
$subject_id_array=array();
while($row = mysql_fetch_assoc($result)) $subject_id_array[]=$row['subject_id'];
//step 2
$matches = implode(',',$subject_id_array);
$sql = "SELECT subject_id,study_code,active,reminders FROM subjects WHERE subject_id IN(
$matches) ORDER BY study_code";
$result = mysql_query($sql, $db);
The MySQl execution time is reduced to few seconds.
Labels:
research
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment