View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
04389Bug reportsOtherpublic2010-06-08 21:51
Reporterjdalegonzalez Assigned Tomdekker  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.87 
Fixed in Version1.90RC1 
Summary04389: abmultiscalequery is executed more times than is necessary
Description

Around line 2337 in index.php, a query is done to grab the labels associated with a "Array, flexible labels, dual scale" question. The query is inside a while loop iterating over the results of the query that pulls in the question and answer table values for the question being fetched. Since the internal query ($abmultiscalequery = ...) doesn't use any of variables populated by the while loop, the query for labels can be moved outside the while loop and be run only once per question.

Further, the exact same query is executed twice inside the loop with no change to the query parameters. One can be removed, right? Once it's used to set the value of $fieldname.$abrow['code']."#0" and the second time it's used to set $fieldname.$abrow['code']."#1".

Finally, in both instances, while all of the values of the label field are fetched, the only thing used is a count of the rows returned. The query could be turned into a "select count() as cnt"; $abmultiscalecount = $result['cnt'] instead of a "select l."; $abmultiscalecount = $result.RecordCount();\

Steps To Reproduce

Look at the code in index.php around line 2336 and verify my analysis

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)8488
I will donate to the project if issue is resolved
BrowserN/A
Database type & versionPostgres but really N/A
Server OS (if known)Linux but really N/A
Webserver software & version (if known)Apache but really N/A
PHP Version5.X but really N/A

Users monitoring this issue

There are no users monitoring this issue.

Activities

Mazi

Mazi

2010-06-04 01:38

updater   ~12133

Carsten, do you think we can close this one because label set handling was completely reworked at version 1.90?

mdekker

mdekker

2010-06-04 11:11

reporter   ~12147

Confirming this is still an issue, even worse, we don't even use the record count anymore. Taking this bug to fix.

mdekker

mdekker

2010-06-04 11:14

reporter   ~12148

Fixed in rev 8789
Thanks for pointing out this issue, it will definately help improve performance.

jdalegonzalez

jdalegonzalez

2010-06-04 21:41

reporter   ~12174

Wow. That was fast. Thanks guys.

Issue History

Date Modified Username Field Change
2010-06-02 19:26 jdalegonzalez New Issue
2010-06-02 19:26 jdalegonzalez Status new => assigned
2010-06-02 19:26 jdalegonzalez Assigned To => user372
2010-06-04 01:38 Mazi Note Added: 12133
2010-06-04 01:38 Mazi Assigned To user372 => c_schmitz
2010-06-04 11:06 mdekker Assigned To c_schmitz => mdekker
2010-06-04 11:11 mdekker Note Added: 12147
2010-06-04 11:14 mdekker Note Added: 12148
2010-06-04 11:14 mdekker Status assigned => resolved
2010-06-04 11:14 mdekker Resolution open => fixed
2010-06-04 11:31 mdekker Fixed in Version => 1.90RC1
2010-06-04 21:41 jdalegonzalez Note Added: 12174
2010-06-08 21:51 c_schmitz Status resolved => closed
2010-10-25 00:21 c_schmitz Category Data Access => (No Category)