PrestaShop/PrestaShop — pull request #1154 by studiokiwik (2013-12-20 11:01:54+00:00)
Title: [*] BO : improvement of multiple sql queries using order current states

Since 1.5.x, there is this field : current_state.

But it's not really used in some request. With 140 000 orders and 278 000 order states, it takes a lot of time to process (~1mn to display one page), because for EACH order, it fetches every single state, and sorts it to extract the last one. I guess that's why "current_state" was created, but some 1.4 stuff is still hiding in the source code.

For the AdminInvoicesController, load time was at 5s, and now it's down to 0.5s. (10 times better !).

(I already did an optimization from 50s to 5s a few days ago, but this one is even better !)