View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005875 | OXID ERP Interface | OXID ERP Interface - sub | public | 2014-09-10 13:41 | 2015-03-17 14:58 |
Reporter | michael_keiluweit | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 2.13.0 | ||||
Target Version | 2.14.0 | Fixed in Version | 2.14.0 | ||
Summary | 0005875: Low perfomance when using view tables (OXERPGetArticles) | ||||
Description | When the table oxarticles has more than ~5.000 records, the query from the ERP function OXERTPGetArticles needs some time to be completed. | ||||
Steps To Reproduce | Create more than 5.000 articles. Do the call OXERPGetArticles (0, 100). Wait. | ||||
Tags | Article, ERP, Performance, SOAP | ||||
related to | 0005867 | resolved | SvenBrunk | Wrong variable naming for $iShopId |
related to | 0005987 | resolved | jurate.baseviciene | Too many tables in a join in get methods |
|
Perfomace increased by adapting two Methods: oxERPType_Article::getSQL() public function getSQL( $sWhere, $iLanguage = 0, $iShopId = 1) { if ( !$this->_aFieldList) { return; } $sSQL = 'select '; $blSep = false; foreach ( $this->_aFieldList as $sField) { if ( $blSep) { $sSQL .= ','; } $sSQL .= $this->_getSqlFieldName($sField, $iLanguage, $iShopId); $blSep = true; } $oCompat = oxNew( "OXERPCompatibility"); if ($oCompat->isShopEE()) { if ($this->_blRestrictedByShopId) { if ( strstr( $sWhere, 'where')) { $sWhere .= ' and '; } else { $sWhere .= ' where '; } $sWhere .= '`a`.`oxshopid` = \''.$iShopId.'\''; } } $sSQL .= ' from '.$this->getTableName($iShopId, $iLanguage) . ' AS `a` '; if ($oCompat->isShopEE() && oxConfig::getInstance()->getConfigParam( 'blMallCustomPrice' )) { $sSQL .= ' LEFT JOIN oxfield2shop AS `f2s` ON `f2s`.`oxartid` = `a`.`oxid`'; $sSQL .= " AND `f2s`.`oxshopid` = '" . $iShopId . "'"; } $sSQL .= ' LEFT JOIN oxartextends AS `ax` ON `ax`.`oxid` = `a`.`oxid`'; $sSQL .= ' ' . $sWhere; return $sSQL; } oxERPType_Article::_getSqlFieldName() protected function _getSqlFieldName($sField, $iLanguage = 0, $iShopID = 1) { $oCompat = oxNew("OXERPCompatibility"); if ($oCompat->isShopPE()) { switch ($sField) { case 'OXORDERINFO': return "'' as $sField"; case 'OXPIXIEXPORTED': return "'0000-00-00 00:00:00' as $sField"; case 'OXPIXIEXPORT': return "'0' as $sField"; case 'OXVPE': return "'1' as $sField"; } } switch ($sField) { // oxlongdesc is valid in all versions case 'OXLONGDESC': case 'OXLONGDESC_1': case 'OXLONGDESC_2': case 'OXLONGDESC_3': // take from oxartextends return '`ax`.'.$sField; } if ('1' == oxERPBase::getUsedDbFieldsVersion()) { switch ($sField) { case 'OXAKTION': case 'OXSEOID': case 'OXSEOID_1': case 'OXSEOID_2': case 'OXSEOID_3': return "'' as $sField"; case 'OXACTIV': return "OXACTIVE as OXACTIV"; case 'OXACTIVFROM': return "OXACTIVEFROM as OXACTIVFROM"; case 'OXACTIVTO': return "OXACTIVETO as OXACTIVTO"; } } if ($oCompat->isArticleRemindActiveFieldFixed()) { switch ($sField) { case 'OXREMINDACTIV': return "OXREMINDACTIVE as OXREMINDACTIV"; } } if ($oCompat->areArticleZoomPicsRemoved()) { if (preg_match('/oxzoom[0-9]+/i', $sField)) { return "'' as $sField"; } } if ($oCompat->isPicsGeneratedFieldRemoved()) { if ( 'OXPICSGENERATED' == $sField ) { return "'' as $sField"; } } if ($oCompat->isShopEE() && oxConfig::getInstance()->getConfigParam( 'blMallCustomPrice' ) ) { $aField2ShopFields = $this->_getMultishopArticleFields(); if ( in_array( $sField, $aField2ShopFields ) ){ return " IFNULL(`f2s`.`$sField`, `a`.`$sField`) as `$sField`"; } } if ($oCompat->isShopPE() && in_array($sField, array('OXSHOPID', 'OXSHOPINCL', 'OXSHOPEXCL'))) { $sField = parent::_getSqlFieldName($sField, $iLanguage, $iShopID); } else { $sField = '`a`.'. parent::_getSqlFieldName($sField, $iLanguage, $iShopID); } return $sField; } |