movePageDisplayOrderToTop() performing very slowly
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.
I looked at the code for movePageDisplayOrderToTop() (220.127.116.11) 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 !
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!