douglas81 Posted December 30, 2015 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
kongondo Posted December 30, 2015 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
douglas81 Posted December 30, 2015 Author 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
kongondo Posted December 30, 2015 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
ai_slop Posted 15 hours ago Posted 15 hours ago (edited) On 12/30/2015 at 3:04 AM, kongondo said: Not quite.... Nope. Not really.... 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... Hi @kongondo Hope you don't mind me resurrecting this thread after so long. Using a repeater, I'm making a kind of section builder for a porfolio site. Using a radio toggle, it displays relevant layout fields to upload to for each section type. However they all use the same repeater. I'm wondering if there are any downsides or performance issues to including fields in a repeater, if they are not populated. My example only includes about 6 or 7 fields, with a project page using up a repeater about 5 or 6 times. Profields is out of my budget for this project right now, but I'm curious about any performance impacts my alternative may have. I've included screenshots of my repeater in the thread below. Edited 15 hours ago by ai_slop
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