ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Is there a limit to what {reverse_related_entries} can do? -- Please advise.

January 16, 2013 3:01am

Subscribe [3]
  • #1 / Jan 16, 2013 3:01am

    KuroiS

    11 posts

    Hello all,

    I’ve ran into a wall here with the {reverse_related_entries} tag.

    I have simple down the whole page to just this relationship bit.


    Working Code:

    {exp:channel:entries channel="series" limit="1"}
            <h2>{title}</h2>
    
    <p>        {reverse_related_entries channel="prices" limit="1"}<br />
                {title}<br />
            {/reverse_related_entries}</p>
    
    <p>{/exp:channel:entries}

    ————————————————————————————-
    What I would like:

    {exp:channel:entries channel="series" }
            <h2>{title}</h2>
    
    <p>        {reverse_related_entries channel="prices" limit="2"}<br />
                {title}<br />
            {/reverse_related_entries}</p>
    
    <p>{/exp:channel:entries}

    When I first did “What I would like” set it actually worked and I was very happy to see it work, which is when I went wild and basically did 2 more sets of this code (on different pages ofcourse).

    However, now its showing ‘php memory issues’ or its giving me a blank page.

    My work around for now if anyone is having the same problem.
    Now, I did find my way around this wall with the sacrifice of 15sec on the load time.
    (calling multiple channel:entries tags and saving them into php arrays, then pushing them together the way I wanted, finally foreach-ing them out.)

    Does anyone have a solution so I would be able use my simple “What I would like” code for my project? And future projects?

    Please advise.

    Thank You,

    Cheers

  • #2 / Jan 16, 2013 9:18am

    Boyink!

    5011 posts

    Let’s ask the obvious question first - what memory do you have available to you on the server?

  • #3 / Jan 16, 2013 12:35pm

    KuroiS

    11 posts

    At first the php memory limit was 32Mb, after I saw the error or memory issue needing 10k bytes more I increased it to 64Mb, at first its the blank screen. Then the memory error came back asking for more.

    What would you believe to be a nice limit for the PHP memory? We are on a VPS that I have no access to in the back end, only the cPanel. I would have to request the limit to be changed.

    Thank You,

  • #4 / Jan 16, 2013 1:02pm

    Boyink!

    5011 posts

    64M is what I have on most of my sites.

    How big is your exp_relationships table?

    Anything else going on that might be sucking memory?

    Have you enabled the output profiler?

  • #5 / Jan 16, 2013 2:14pm

    KuroiS

    11 posts

    Hello BoyInk,

    Thank you for helping me out here.

    My exp_relationship table
    exp_relationships 1699 Records 31.4 MB in size
    (this number is continuing to increase. )

    I did make a habit of having the output profiler on all the time to keep track of the load time and queries. 

    I’ve been testing around a bit with the working code to find the line where it breaks and I can for sure say that it breaks on when the limit of the channel:entries tag hits more than 13.

    I guess that really tells that its due to the lack of memory for PHP? however, it doesn’t say that I need more memory anymore, because if I see the memory error, I would know how much I’m missing right?

  • #6 / Jan 16, 2013 2:25pm

    KuroiS

    11 posts

    By the way your EE2 manual was one of the material that I’ve got to learn EE, it’s great. Good work on that! Helped a lot.

  • #7 / Jan 17, 2013 9:50am

    Boyink!

    5011 posts

    Glad to hear it!

    That’s a big relationship table - twice the size of my entire Train-ee website database.  Try doing db repair/compact?

    Otherwise maybe it’s time to look at Playa for your relationship needs.

  • #8 / Jan 18, 2013 3:12am

    KuroiS

    11 posts

    Glad to hear it!

    That’s a big relationship table - twice the size of my entire Train-ee website database.  Try doing db repair/compact?

    Otherwise maybe it’s time to look at Playa for your relationship needs.

    That is the best solution I believe.

    I cleared the exp_relationship table and all my testing data. Now with only one set of data, everything looks fine.

    However, large exp_relationship table “isn’t not” work able. It just means that we have to limit the “channel:entries” tag that is wrapping the “reverse_related_entry” tag.

  • #9 / Jan 18, 2013 9:37am

    Boyink!

    5011 posts

    Just keep an eye on that table - EE is caching a bunch of the channel:entry content in order to quickly load related data. But as it grows it will take longer to update from the CP and load from the front-end.

  • #10 / Jan 29, 2013 9:45am

    nsleg

    3 posts

    That’s a big relationship table - twice the size of my entire Train-ee website database.  Try doing db repair/compact?

    I am having a similar problem, and my exp_relationships table is even bigger (2,920 records & 162.6 MB).  What should I use to ‘repair/compact’?

  • #11 / Jan 29, 2013 9:47am

    Boyink!

    5011 posts

    Tools / Data / Sql Manager / Manage Database Tables - select then repair, select then optimize.

  • #12 / Jan 29, 2013 9:51am

    nsleg

    3 posts

    Wow.  Thanks for the quick response.  How much improvement should I expect to see?

  • #13 / Jan 29, 2013 9:52am

    Boyink!

    5011 posts

    No telling.

  • #14 / Jan 29, 2013 10:18am

    nsleg

    3 posts

    Hm.  That brought the table down to 148 MB, but my page with reverse relationships still won’t render if I go above 9 (primary) records.

    phpInfo() indicates that memory_limit is 128M so, assuming that’s the right value, it’s higher than those mentioned above.

  • #15 / Jan 29, 2013 3:20pm

    Boyink!

    5011 posts

    I’d be looking at a Playa based approach in that case. I think you’ve simply exceeded the expectations of use for this feature.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases