Details
-
Improvement
-
Resolution: Unresolved
-
Medium
-
5.4.0
-
None
Description
Every time the viewcache of a content with an ezkeyword field is cleared, long keyword-related queries are generated, even if the content has no actual keyword data (i.e. the keywords fields are empty). Example:
SELECT DISTINCT substring( ezkeyword.keyword from 1 ) AS keyword ,ezco ntentobject_tree.node_id, ezcontentobject.publishedn FROM ezkeywordn INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribut e_link.keyword_id = ezkeyword.id)n INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribu te_id)n INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contento bject_id = ezcontentobject.id)n INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)n INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)n n INNER JOIN ezcobj_state_link ezcobj_state_lnk_0_perm ON (ezcobj_state_lnk_0_perm.contentobject_id = ezcontentobject.id) INNER JOIN ezcobj_state_group ezcobj_state_grp_0_perm ON (ezcobj_state_grp_ 0_perm.identifier = 'object_state') INNER JOIN ezcobj_state ezcobj_state_0_perm ON (ezcobj_state_0_perm.id = ezc
These queries can have a detrimental effect in performance, especially in environments with large databases. Since there is no actual keyword data, these queries shouldn't be generated in the first place. In line with that, the following workaround has been used:
svn diff kernel/content/ezcontentfunctioncollection.php Index: kernel/content/ezcontentfunctioncollection.php =================================================================== --- kernel/content/ezcontentfunctioncollection.php (revision 14824) +++ kernel/content/ezcontentfunctioncollection.php (working copy) @@ -856,7 +856,7 @@ AND ezcontentobject.status = " . eZContentObject::STATUS_PUBLISHED . " AND ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id"; - $keyWords = $db->arrayQuery( $query ); + //$keyWords = $db->arrayQuery( $query ); // cleanup temp tables $db->dropTempTableList( $sqlPermissionChecking['temp_tables'] ); @@ -1030,7 +1030,7 @@ AND ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id ORDER BY {$sortingInfo['sortingFields']}"; - $keyWords = $db->arrayQuery( $query, $db_params ); + //$keyWords = $db->arrayQuery( $query, $db_params ); $trans = eZCharTransform::instance();
Please enhance the system so that these queries will not be generated if there is no actual keyword data.