0

We're running Magento 2.1.5 CE, and I have a very specific speed issue with the Admin Backend. My frontend responds very quickly, and MOST of the admin backend is very fast as well, but with one exception: If I search in Orders for something that cannot be found, the search takes several minutes to complete and show me that there are no matches. If I search for something that can be found, the results appear in just a second or 2.

I've made a video that shows exactly what I'm talking about, which can be viewed here: Video Demonstrating The Problem.

Can anyone offer some help for how to speed this up?

  • Does it take also that long when you type the phrase directly in the search bar on orders page? – Zefiryn Apr 7 '17 at 18:52
  • Yes, it does not matter where I put in the search term - in the search bar, in the filters, or in the global search. – Kimball Apr 7 '17 at 19:25
1

On my installation it works pretty fast although I do not have many orders yet. But the query in the db I see in my code looks like this

SELECT `main_table`.* FROM `sales_order_grid` AS `main_table` WHERE (MATCH(`main_table`.increment_id,`main_table`.billing_name,`main_table`.shipping_name,`main_table`.shipping_address,`main_table`.billing_address,`main_table`.customer_name,`main_table`.customer_email) AGAINST('fdsfdsfsdsdfsdfsddsfsdfd')) ORDER BY created_at DESC LIMIT 20

You can try to execute it directly in your database. If it takes a long time you know the problem is with the query and your database structure. In that case do

 EXPLAIN SELECT `main_table`.* FROM `sales_order_grid` AS `main_table` WHERE (MATCH(`main_table`.increment_id,`main_table`.billing_name,`main_table`.shipping_name,`main_table`.shipping_address,`main_table`.billing_address,`main_table`.customer_name,`main_table`.customer_email) AGAINST('fdsfdsfsdsdfsdfsddsfsdfd')) ORDER BY created_at DESC LIMIT 20

And see what information you get.

But this might not be exactly your case. It looks like you have some adjustment in the grid which adds table of ordered products. The question is how they are added there. If the module you use for that is hooking into grid generation it may join this query with products table and this join may cause some problems. You can easily test this by disabling the module responsible for that functionality. If this is your bottleneck ask the developer to optimize it.

  • I just ran your query, and it returns 0 results in 1.2ms, so that's not the bottleneck. You may very well be onto something with my orders grid... I do have a plugin installed there that shows extra information. I'll try disabling it now and see if the slowdown disappears. If it does, you are exactly right and I'll pester the developer to fix things up. – Kimball Apr 7 '17 at 19:27
  • After disabling the order grid extension, the search performance is exactly what you would expect - when searching for orders with a search term that will yield 0 results the search completes nearly instantly. Re-enable the order grid extension, and the performance goes back to abysmal. I'm reaching out to the developer of the extension now. Thanks for the help! – Kimball Apr 7 '17 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.