Jump to content

How to troubleshoot DB timeouts with data.php?


MarcC
 Share

Recommended Posts

I'm experiencing DB timeouts when I try to edit a page with a bunch of repeaters (less than 50). The page data is very zippy on the public front end, though. Where should I start to troubleshoot this?

Link to comment
Share on other sites

I can't open it at all via the back end, so no screenshot is available at present. :( The repeater has four fields: One page reference (category) and three text / textarea inputs. The front end of the site does iterate those items, but as I said there doesn't appear to be a delay there.

Link to comment
Share on other sites

What are the settings on that page reference field? Usually when you've got a timeout, there is some circular reference. For example, a repeater referencing a category page that in turn somehow references back to the original page. Or a page reference in a repeater that references back to the parent page or repeater items. ProcessWire detects and prevents most of this, but the question becomes more complex when a repeater is involved. What were the last edits you made before the timeout started occurring? I don't think it's an issue of quantity, I really think there must be some kind of circular reference in there, especially given that a Page reference in the repeater. You may be able to track it down by editing the repeater pages directly: Page List > Admin > Repeaters > drill down to it from there.

Link to comment
Share on other sites

Actually, I was wrong about the page ref--that's just a text field called "category". I'm looking at the repeater entries in the Admin but not seeing anything potentially troublesome yet. I will keep looking.

Link to comment
Share on other sites

OK, update:

We are nesting one repeater inside of another (that is, we have a repeater field as one of the fields in a repeater field that we are using in a template). Other than that complication, both repeaters are quite small and only have a couple text fields.

While digging for the issue in the original post, we noticed that there are many, many unpublished blank placeholders of the inner repeater. Like, a lot. We suspect that because the default value for "Ready-to-edit New Repeater Items" in the Details section of repeater field setup is "3", somehow the inner repeater kept generating ready-to-edit items unexpectedly.

We have set this setting to "0" now, and hopefully the problem will go away. Of course, we don't really know what is causing this issue, and how nested repeaters interact. But it would be great if this could be fixed, unless you think nested repeaters is undefined behavior (in the which case the API or at least the admin interface should disallow it).

Link to comment
Share on other sites

Nested repeaters may be technically possible, but the potential overhead would be huge and it seems like all sorts of possible complications could arise. So definitely not recommended. You are right that I should remove the capability to do it--I've just made this change and will be committed shortly.

Link to comment
Share on other sites

Thanks, Pete & Ryan. It was nice while it worked, but it seems to me that it added a bit of admin UI complexity too. Since the number of nested repeaters used was pretty homogenous anyway, we're going to move to a set number of static text fields for those sub-listings. Appreciate the quick support.

  • Like 1
Link to comment
Share on other sites

i tried to got nested repeaters working and when it fails i read here that ryan closed the option to do this. the problem that i have is that i thought i need nested repeaters but maybe someone have an idea without repeaters. i work on a project about historical books. for example you have 20 sheets of paper of court decisions from berlin between 1850 and 1875 and you have another 100 sheets between 1899 and 1914. that scenario were fine for repeatable fields but now the complex part comes in. the information about the number of sheets can include more than one runtime. for example the 20 sheets above is about the time between 1850-1875 and 1880-1882. now i would need a nested repeater. has someone an idea or can i open the possibility to get nested repeaters working for myself somewhere in the code? thanks a lot...

on the screenshot i would like to have the range reapeater into the runtime repeater

Bildschirmfoto%202012-08-27%20um%2010.53.29.png

Link to comment
Share on other sites

i tried to got nested repeaters working and when it fails i read here that ryan closed the option to do this. the problem that i have is that i thought i need nested repeaters but maybe someone have an idea without repeaters. i work on a project about historical books. for example you have 20 sheets of paper of court decisions from berlin between 1850 and 1875 and you have another 100 sheets between 1899 and 1914. that scenario were fine for repeatable fields but now the complex part comes in. the information about the number of sheets can include more than one runtime. for example the 20 sheets above is about the time between 1850-1875 and 1880-1882. now i would need a nested repeater. has someone an idea or can i open the possibility to get nested repeaters working for myself somewhere in the code? thanks a lot...

on the screenshot i would like to have the range reapeater into the runtime repeater

Bildschirmfoto%202012-08-27%20um%2010.53.29.png

I can't see what fields are in the Range repeater but maybe it's an option to just add a text field to the runtime repeater and just enter the ranges seperated by a delimiter of your choice, so: 1850-1875,1880-1882. You can use explode for front-end purposes.

Of course this all depends on your needs. Most of the times when i see nested repeaters is start to wonder if there isn't a better way to structure your content.

Link to comment
Share on other sites

I'm not sure that I understand the specific situation here... read it over a couple times and still can't seem to visualize it. But that could just be because I'm still waiting for the coffee to kick in here. :) But I wanted to mention that repeaters are nothing but groups of pages. Very often, you are better off to just use your own group of pages to create the same structure, rather than creating a repeater. So you technically could get the structure you are wanting if you go back and use traditional pages to create the structure. Repeaters aren't the place to create particularly complex data structures, but pages are.

Link to comment
Share on other sites

haha, i send a virtual coffee to sinnut and ryan :rolleyes:.

first, i began to code the site with codeigniter, but don't call me a programmer. i like coding and do my best but when i start to follow processwire i thought there is a good idea to migrate the site to it. the reason is because you have an user/role-system, a interface for custom fields, the selector engine and repeaters. before version 2.2 comes bundled with repeaters i tested my data with pages but tend to stay with codeigniter. so far i ended up with the following...

Bildschirmfoto%202012-08-27%20um%2016.55.20.png

it works but the database queries and the other stuff becomes a little bit complicated for me so i wanted to migrate to pw.

i downgrade to processwire 2.2.4 with nested repeaters and thought the following screen were a good idea...

Bildschirmfoto%202012-08-27%20um%2016.53.10.png

i think my client like the idea to have the whole information about a book on one page. when i use pages i have a structure like book->runtime->range right? then i could have as many runtime or range pages as possible. thats so far the story :-)

Link to comment
Share on other sites

I would also go for a structured page tree and see the page tree as the main repeater. :D

Edit: need some sleep.. so also what I wanted to add you could keep the structure ...->book(page)->runtime(repaeter-range). So if the level of information becomes 1 dimensional use a repeater there i.e. runtime has a repater for range.

Book1

->Runtime1

->Runtime2

- range1

- range2

Book2

...

Also depends a lot on how you want to be able deal with these data. Maybe some thought about what you want to be able to do with it later i.e. if storing data in json format or comma separated strings, you'll have hard time to filter content based on that. Using a page structure will, at the best, let you use simple PW selector queries to filter or search the data.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...