Path

ez projects / ezobjectstatesfilter / forum / general / slow query when selecting m...


Slow query when selecting more than one state

You need to be logged in to post messages in the forums. New users may register here.

Benjamin Lorteau

Member since:
03 July 2008

Posts: 7

Wednesday 02 February 2011 7:15:51 pm

Hello,

I'm encountering a slow query when I use the extended attribute filter with two objects states.

Fetch :



{def $article_list=fetch('content', 'tree', hash(


 'parent_node_id', ezini('NodeSettings', 'RootNode', 'content.ini'),


 'class_filter_type', 'include',


 'class_filter_array', $topic_classes,


 'attribute_filter', array(array('owner', '=', $node.contentobject_id)),


 'extended_attribute_filter', hash(


   'id', 'ObjectStateFilter',


   'params', hash(


     'states_identifiers', array(


       'site_publish/site_published',


       'site_publish/site_highlight'


     ),


     'operator', 'or'


   )


 ),


 'offset', $view_parameters.offset,


 'limit', $replies_per_page,


 'sort_by', array( array( 'published', false() ) ),


))}




SQL Query :



SELECT DISTINCT


                      ezcontentobject.*,


                      ezcontentobject_tree.*,


                      ezcontentclass.serialized_name_list as class_serialized_name_list,


                      ezcontentclass.identifier as class_identifier,


                      ezcontentclass.is_container as is_container


                       

                      , ezcontentobject_name.name as name, ezcontentobject_name.real_translation 

                       

                       

                  FROM


                     ezcontentobject_tree,


                     ezcontentobject,ezcontentclass


                     , ezcontentobject_name 

                      

                      

                     , ezcobj_state_group sg1, ezcobj_state s1, ezcobj_state_link sl1, ezcobj_state_group sg2, ezcobj_state s2, ezcobj_state_link sl2


                     , ezcobj_state_link ezcobj_state_lnk_0_perm , ezcobj_state_group ezcobj_state_grp_0_perm , ezcobj_state ezcobj_state_0_perm 

                  WHERE


                      ezcontentobject_tree.path_string like '/1/2/4265/%' and  

                      ( ( sg1.identifier="site_publish"


                            AND sg1.id=s1.group_id


                            AND s1.identifier="site_published"


                            AND sl1.contentobject_state_id=s1.id


                            AND sl1.contentobject_id=ezcontentobject.id ) or ( sg2.identifier="site_publish"


                            AND sg2.id=s2.group_id


                            AND s2.identifier="site_highlight"


                            AND sl2.contentobject_state_id=s2.id


                            AND sl2.contentobject_id=ezcontentobject.id ) ) AND 

                      

                                                 ( ezcontentobject.owner_id = '10126' ) AND 

                     ezcontentclass.version=0 AND


                     ezcontentobject_tree.node_id != 4265 AND


                     ezcontentobject_tree.contentobject_id = ezcontentobject.id AND


                     ezcontentclass.id = ezcontentobject.contentclass_id AND


                      

                        ezcontentobject.contentclass_id IN ( 46, 60, 54, 17, 50, 34, 51, 48, 49, 52, 16 ) AND


                      ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id and


                                  ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version and 

 ( ezcontentobject_name.language_id & ezcontentobject.language_mask > 0 AND


    ( (  ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & 1 )


  + ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & 2 ) )


  <


    ( ezcontentobject_name.language_id & 1 )


  + ( ( ezcontentobject_name.language_id & 2 ) )


 ) 

 

                     AND ezcontentobject_tree.is_invisible = 0


                     AND ezcobj_state_lnk_0_perm.contentobject_id = ezcontentobject.id AND ezcobj_state_0_perm.id = ezcobj_state_lnk_0_perm.contentobject_state_id AND ezcobj_state_0_perm.group_id = ezcobj_state_grp_0_perm.id AND ezcobj_state_grp_0_perm.identifier='site_publish' AND ((ezcontentobject.section_id in (1, 12, 2, 3, 6)) OR (ezcontentobject.section_id in (11) AND ezcobj_state_0_perm.id IN ( 4, 8, 9 )) OR (ezcontentobject.section_id in (1, 11, 2, 3, 6, 8, 9)) OR (ezcontentobject.section_id in (7)) OR (ezcontentobject.section_id in (10))) 

                      

                      AND 

 ezcontentobject.language_mask & 3 > 0 

 

                ORDER BY ezcontentobject.published DESC


LIMIT 0, 10




What am I doing wrong ?

eZ Publish personal project : http://www.aeriesguard.com [fr]

Up

Damien Pobel

Member since:
09 January 2008

Posts: 40

Thursday 03 February 2011 9:02:13 am

HI Benjamin,

You probably don't do anything wrong :-)

Could you run an EXPLAIN of the generated query with and without the extended attribute filter and post the result to see what is wrong in this query ?
Perhaps it's not related to the extension but to eZ Publish. See http://issues.ez.no/17881

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Up

You need to be logged in to post messages in the forums. New users may register here.