Retrofit from trunk

N°1026 - Portal requests are too slow
* Counts on union requests are more optimized
* Requests for combo box values are more optimized [from revision 5249]

SVN:2.4[5250]
This commit is contained in:
Eric Espié
2018-01-16 08:46:49 +00:00
parent b286bd48c7
commit cbd3d2c165
2 changed files with 20 additions and 8 deletions

View File

@@ -496,6 +496,16 @@ class DBUnionSearch extends DBSearch
$aSearchSelectedClasses[$sSearchAlias] = $this->aSelectedClasses[$sAlias]; $aSearchSelectedClasses[$sSearchAlias] = $this->aSelectedClasses[$sAlias];
} }
if ($bGetCount)
{
// Select only ids for the count to allow optimization of joins
foreach($aSearchAliases as $sSearchAlias)
{
$aQueryAttToLoad[$sSearchAlias] = array();
}
}
else
{
if (is_null($aAttToLoad)) if (is_null($aAttToLoad))
{ {
$aQueryAttToLoad = null; $aQueryAttToLoad = null;
@@ -511,6 +521,7 @@ class DBUnionSearch extends DBSearch
$aQueryAttToLoad[$sQueryAlias] = $aAttributes; $aQueryAttToLoad[$sQueryAlias] = $aAttributes;
} }
} }
}
if (is_null($aGroupByExpr)) if (is_null($aGroupByExpr))
{ {

View File

@@ -103,6 +103,7 @@ class BsSelectObjectFieldRenderer extends FieldRenderer
$oOutput->AddHtml('<option value="">')->AddHtml(Dict::S('UI:SelectOne'), false)->AddHtml('</option>'); $oOutput->AddHtml('<option value="">')->AddHtml(Dict::S('UI:SelectOne'), false)->AddHtml('</option>');
// - Retrieving choices // - Retrieving choices
$oChoicesSet = new DBObjectSet($oSearch); $oChoicesSet = new DBObjectSet($oSearch);
$oChoicesSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => array('friendlyname')));
while ($oChoice = $oChoicesSet->Fetch()) while ($oChoice = $oChoicesSet->Fetch())
{ {
// Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int) // Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int)