movePageDisplayOrderToTop() performing very slowly

Permalink
I wrote a portal which accepts prescriptions -- requests from local periodontists for patient oral imaging.

It uses a customized grid display so that users can view all of the current and past prescriptions in their account, as well as the status. The grid displays page titles -- pages being the method of displaying a specific prescription when selected.

One of the features of the grid is that it displays prescriptions in a most recent/first order. To accomplish this, clearly the movePageDisplayOrderToTop() method in the Page model is the appropriate solution.

Things have been running well for a number of years, but, now with thousands of created pages, we're running into a significant slowdown on entering a new prescription.

I just now digging into the code, but thought someone might have some ideas. I thought increasing the size of memory might help -- as some of the work involves array manipulation of the pages. But, that didn't have any recognizable impact.

Thanks.

View Replies:
WillemAnchor replied on at Permalink Reply
WillemAnchor
Hi jvansanten,

I looked at the code for movePageDisplayOrderToTop() (5.7.5.3) and this calls updateDisplayOrder() for every page.

updateDisplayOrder() itself updates the order in the database. For 1000+ pages, this can take some time...

Is it possible to leave the display order as is, and retrieve a sorted list of pages from the database instead ? That would take only 1 call to the dbase...

Good luck !
jvansanten replied on at Permalink Reply
Thanks for your investigation.

Yes, it looks like changing the display rather than changing the physical ordering in the database table looks like the way to go. I'll need to change the ordering in the 3rd party grid.

All the best!
WillemAnchor replied on at Permalink Reply
WillemAnchor
The page-list block might help you. If not by function, then by code.
jvansanten replied on at Permalink Reply
Yeah, the 3rd party package, unfortunately, overwrote the setup property ordering the content. Thus, early on, the workaround by reordering the pages proper. I've rewritten the code to make the setup configuration persistent.

It's zippy!