This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Database queries

Database queries

Database queries

Thursday 15 August 2013 9:10:45 pm - 1 reply

I am trying to filter the items displayed on my page based on the selections a user makes I am doing to following fetch to get a list of my products 

{def $products = fetch( content, tree, hash( 'parent_node_id', 5745, extended_attribute_filter, hash( id, TagsAttributeFilter, params, hash(tag_id,$section_tag)), class_filter_type, include, class_filter_array, array( fs_product ) )) }

The fetch gets about 500 results. I am then trying to loop though the results and get something from the datamap

{foreach $products as $product} 



This is causing the load time on my website to double and my Database queries to go from around 200 to around 1200. Is this normal? Is there a better way I should/could be doing this? Any help is appriciated. 

Modified on Thursday 15 August 2013 9:13:11 pm by Luke Konecki

Tuesday 20 August 2013 5:04:25 am

Hi Luke,

You should fetch the objects using an offset and a limit to avoid the fetching of 500 object in a single query.

Using a pager could also help you to manage offset change.

You'll find more here :

(search text "Fetching subsets"blunk.gif Emoticon

I could write an example of code if you got some trouble to set a pager.



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from