douglas81 Posted December 30, 2015 Share Posted December 30, 2015 Every now and then I'll run into a post where Ryan seems to be suggesting Repeater fields are limited in some way, or at least not as extensible as pages. I get that. But I've also seen mention that it's not always good to have too many repeater fields as it has an effect on database rows, or columns, or something like that. I understand this has something to do with the limitations of mysql databases, or something? I wonder if someone could tell me how cautious I need to be using Repeaters and what I should be bearing in mind. I seem to be using Repeaters quite a lot, mostly when I want a user to be able to add photos or files to a page, but I want the user to be able to also add information to that file, like captions or maybe have multiple formats of the same file. 1 Link to comment Share on other sites More sharing options...
kongondo Posted December 30, 2015 Share Posted December 30, 2015 (edited) ... it has an effect on database rows, or columns, or something like that. Not quite.... I understand this has something to do with the limitations of mysql databases, or something? Nope. Not really.... I wonder if someone could tell me how cautious I need to be using Repeaters and what I should be bearing in mind The most important thing to remember about repeaters is that behind the scenes, they are actually real pages (see /admin/repeaters). Not unlike the recommendation to be cautious with $page->children, if you have too many repeaters (and especially with lots of fields), you will be loading all of them into memory when you call the repeater. With $page->children, you can at least do $page->children('limit=20'); So, the issue is about memory/efficiency. Nothing to do with MySQL (which can easily handle millions of rows - of course, we don't load all of these into memory at once ). In conclusion, repeaters do not scale infinitely... Edited December 30, 2015 by kongondo 4 Link to comment Share on other sites More sharing options...
douglas81 Posted December 30, 2015 Author Share Posted December 30, 2015 Thanks for that. Okay, that's making sense. When you say it loads them all into memory when I call the repeater... when does this happen? Like when I do a $page->some_repeater type call? Is it not possible to limit that also? using $page->some_repeater("limit=10")? And I hope I'm not being totally obtuse here, but when you say it loads them into memory, I guess you mean the pageArray for each repeater, right? With regards the MySQL thing... okay, I wonder where I have got that idea from. Maybe it was fields I was thinking about? I'm sure I remember reading something about a suggestion to try and limit fields to a certain amount. Or something along the lines of pages being nigh-on infinitely scalable, whereas fields have a limit. Does that sound totally off the mark? 1 Link to comment Share on other sites More sharing options...
kongondo Posted December 30, 2015 Share Posted December 30, 2015 Have a read here: http://processwire.com/api/fieldtypes/repeaters/ And this post: https://processwire.com/talk/topic/4442-pw-performance-with-hundreds-of-fields/?p=43643 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now