Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Relation Performance


Go to End


2 Posts   769 Views

Avatar
zenmonkey

Community Member, 545 Posts

15 April 2012 at 1:27am

Ok I have a performance question. Consider the following

Page A has many Object B and has Many Object C
Object B Has One Page A and Has 1 Object C
Object C Has One Page A and Many Object B

When I render the page and I need to get the Object B has 1 Object C relation, does it run the relation query for each instance of Object B or does SS already know it has Object C because of the Has Many Relation with the page?

I know its not a big deal on small numbers, but I worry at how it will scale. Would it be better to cache Object B and Object C and pull the relationship data from that cache or will the extra filter operations cancel any performance gains?

Avatar
martimiz

Forum Moderator, 1391 Posts

15 April 2012 at 4:19am

You could maybe check out what happens by adding a ?showqueries=1 to your URL. I often use that in situations like this...