Taxonomies excessive sql queries - Frontend


When listing content from taxonomies, Orchard is sending multiple sql queries per content item instead of grabbing all the data in one query. On my site, for a page listing 50 content items, it is sending 125 queries. This inefficiency wastes resources and is slow to process.

I see the issue whether routing to a taxonomy term directly or using a projection of items that have a taxonomy field.

Discussion here


sebastienros wrote May 28, 2013 at 7:18 PM

This how Orchard actually works by default. Taxonomies don't know what things you need to display, so it won't load eagerly everything in one query, but on demand (lazy loading + select N+1 issues). If you want to optimize it you will need your own controller. Will be fixed with Orchard 2.0 when we use a document db.

** Closed by sebastienros 05/28/2013 11:18AM

Jetski5822 wrote Jul 9, 2013 at 11:23 AM

Seb, It looks like the Syscache module does not pick the taxonomy terms up when lazy loaded. Any reason why?

Jetski5822 wrote Jul 9, 2013 at 11:25 AM

Infact Sys cache does not cache them at all.

Jetski5822 wrote Jul 10, 2013 at 10:19 PM

Fixed in changeset 815b62948a5d

sfmskywalker wrote Mar 28, 2014 at 1:28 AM

Fixed in changeset 49b32de9b0254ba6ce024ef0ec90f4d167983be4