Page 2 of 2

Re: [SOLVED] search is very slow

Posted: Wed Mar 07, 2012 6:04 am
by vildamatilda
nodric wrote:If it helps anyone finding this, our search, and general site speed was slowing down now we had grown to +300 categories, and over 1000 products, with over 300 options.

I added most of what Simon suggested (my suggestions are below) and the site is now like lighting! Near instantaneous, and here I was bitching to my host ;D I should have remembered to be a good DBA!

Code: Select all

ALTER TABLE `category` ADD INDEX ( `parent_id` ) ;
ALTER TABLE `category` ADD INDEX ( `top` ) ;
ALTER TABLE `category` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `category` ADD INDEX ( `status` ) ;
ALTER TABLE `option` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `option_description` ADD INDEX ( `name` ) ;
ALTER TABLE `option_value` ADD INDEX ( `option_id` ) ;
ALTER TABLE `option_value_description` ADD INDEX ( `option_id` ) ;
ALTER TABLE `order` ADD INDEX ( `customer_id` ) ;
ALTER TABLE `product` ADD INDEX ( `model` ) ;
ALTER TABLE `product` ADD INDEX ( `sku` ) ;
ALTER TABLE `product` ADD INDEX ( `upc` ) ;
ALTER TABLE `product` ADD INDEX ( `manufacturer_id` ) ;
ALTER TABLE `product` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `product` ADD INDEX ( `status` ) ;
ALTER TABLE `product_option` ADD INDEX ( `option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `product_option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `product_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `option_value_id` ) ;
ALTER TABLE `product_tag` ADD INDEX ( `product_id` ) ;
ALTER TABLE `product_tag` ADD INDEX ( `tag` ) ;



possible to get this to work on the version 1.4.9.3?? experience my page real slow and do not know why or what happened. Is there anyone who can look at my page and see if this module may be able to fix the problem.
www.webshop.barnbutikenvildamatilda.se
appreciate all the help I can get

Re: [SOLVED] search is very slow

Posted: Fri Mar 09, 2012 11:53 am
by nodric
You need one of the OC experts to help you. I just followed Simon's suggested route. However, these are SQL indexes, so they can be applied to any SQL DB, but I don't know the structure of 1.4.x OC. Hopefully someone will answer who does.

Re: [SOLVED] search is very slow

Posted: Fri May 18, 2012 7:56 pm
by annelim
does V1.5.2.1 need to do so ? cause i try run it but it show
ALTER TABLE `category` ADD INDEX ( `parent_id` ) ;# 1907 rows affected.
ALTER TABLE `category` ADD INDEX ( `top` ) ;# 1907 rows affected.
ALTER TABLE `category` ADD INDEX ( `sort_order` ) ;# 1907 rows affected.
ALTER TABLE `category` ADD INDEX ( `status` ) ;# 1907 rows affected.

does any one know what is it mean?

Re: [SOLVED] search is very slow

Posted: Fri May 18, 2012 8:56 pm
by JAY6390
Those updates are correct, that just means it's added the index to the current categories

Re: [SOLVED] search is very slow

Posted: Sat May 19, 2012 12:19 pm
by annelim
thank you JAY.

what does it mean for this ? it happen last night when category is loading
Notice: Undefined index: parent_id in catalog/controller/module/category_superfish.php on line 81

Re: [SOLVED] search is very slow

Posted: Sat May 19, 2012 2:09 pm
by Aimeeing
I first ran the two lines recommended by you and ran a search and the time was still awful and then I ran the rest of the commands as recommended by uksitebuilder and the search was very fast.

Re: [SOLVED] search is very slow

Posted: Tue May 22, 2012 5:59 pm
by madimar
What about a 1.5.2.x release? Can we use the same 1.5.1.3 script?

Re: [SOLVED] search is very slow

Posted: Tue May 22, 2012 7:32 pm
by JAY6390
The above should pretty much solve it again Madimar yes

Re: [SOLVED] search is very slow

Posted: Mon Aug 20, 2012 6:08 am
by bluelayer
the new v1.5.4 version include new searchable boxes... they become with mysql index already? (or something like...)

Re: [SOLVED] search is very slow

Posted: Wed Aug 22, 2012 10:17 am
by JoNails
I have Version 1.5.0. Will the code work for this version? I tried running the query and there was an error. Please help.

Re: [SOLVED] search is very slow

Posted: Tue Oct 30, 2012 3:40 am
by JoNails
Is there any updated script for V. 1.5.4? I had tried to run the script but it gave me so much errors and bug on my site.

Re: [SOLVED] search is very slow

Posted: Thu May 02, 2013 4:33 am
by jsmoove
Hi,

I really need some help. I ran indexes, checked on MyPHPAdmin for duplicate indexes and cleared them, and checked everything. My site runs searches to include sub-categories and it's not loading the products for newer sub-categories for some reason.

Thanks in advance

Re: [SOLVED] search is very slow

Posted: Wed Aug 07, 2013 9:33 pm
by therugworld
Would this be useful for v 1.5.3 or is this already integrated in this version? Someone please reply if you know.

Thanks!

Re: search is very slow

Posted: Tue Sep 10, 2013 12:48 pm
by rodricrzz
uksitebuilder wrote:Run these commands in PHPMyAdmin

Code: Select all

ALTER TABLE `category` ADD INDEX ( `parent_id` ) ;
ALTER TABLE `category` ADD INDEX ( `top` ) ;
ALTER TABLE `category` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `category` ADD INDEX ( `status` ) ;
ALTER TABLE `option` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `option_description` ADD INDEX ( `name` ) ;
ALTER TABLE `option_value` ADD INDEX ( `option_id` ) ;
ALTER TABLE `option_value_description` ADD INDEX ( `option_id` ) ;
ALTER TABLE `order` ADD INDEX ( `customer_id` ) ;
ALTER TABLE `product` ADD INDEX ( `model` ) ;
ALTER TABLE `product` ADD INDEX ( `sku` ) ;
ALTER TABLE `product` ADD INDEX ( `upc` ) ;
ALTER TABLE `product` ADD INDEX ( `manufacturer_id` ) ;
ALTER TABLE `product` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `product` ADD INDEX ( `status` ) ;
ALTER TABLE `product_option` ADD INDEX ( `option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `product_option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `product_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `option_value_id` ) ;
ALTER TABLE `product_tag` ADD INDEX ( `product_id` ) ;
ALTER TABLE `product_tag` ADD INDEX ( `tag` ) ;
ALTER TABLE `url_alias` ADD INDEX ( `query` ) ;
ALTER TABLE `url_alias` ADD INDEX ( `keyword` ) ;
ALTER TABLE `user` ADD INDEX ( `username` ) ;
ALTER TABLE `user` ADD INDEX ( `password` ) ;
ALTER TABLE `user` ADD INDEX ( `email` ) ;
This works for v1.5.4.1?

Re: [SOLVED] search is very slow

Posted: Mon Sep 30, 2013 6:39 am
by Spiritcraft
How about v1.5.5.1? Is this something I should do?

Re: [SOLVED] search is very slow

Posted: Tue Oct 22, 2013 7:15 pm
by barelius
Tried the Database modifications by adding INDEX, this is helping the first 2-3 times I'm requesting the page. After 2-3 pageviews of the Category pages I'm getting back to the old 35 second from the 1-2 seconds execution.

I'm using VQmod and Page Cache, can this affect ?

Re: [SOLVED] search is very slow

Posted: Wed Jun 25, 2014 1:17 pm
by thegurge
Loaded a sample 1000 products to the site i'm converting and it slowed down to a crawl.

These indexes have solved that problem.

Saved me having to start fiddling around working out what indexes to create.

Thanks :)

Re: [SOLVED] search is very slow

Posted: Wed Oct 24, 2018 5:50 pm
by khnaz35
uksitebuilder wrote:
Sat Mar 03, 2012 5:13 pm
If your tables are prefixed, you should add the prefix to each table name in the code posted above
Is this rule can be applied on OC 2.3.0.2 as well i know this is a very old topic

Re: search is very slow

Posted: Sun Feb 09, 2020 10:58 pm
by khurrum
uksitebuilder wrote:
Tue Aug 30, 2011 2:54 pm
Run these commands in PHPMyAdmin

Code: Select all

ALTER TABLE `category` ADD INDEX ( `parent_id` ) ;
ALTER TABLE `category` ADD INDEX ( `top` ) ;
ALTER TABLE `category` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `category` ADD INDEX ( `status` ) ;
ALTER TABLE `option` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `option_description` ADD INDEX ( `name` ) ;
ALTER TABLE `option_value` ADD INDEX ( `option_id` ) ;
ALTER TABLE `option_value_description` ADD INDEX ( `option_id` ) ;
ALTER TABLE `order` ADD INDEX ( `customer_id` ) ;
ALTER TABLE `product` ADD INDEX ( `model` ) ;
ALTER TABLE `product` ADD INDEX ( `sku` ) ;
ALTER TABLE `product` ADD INDEX ( `upc` ) ;
ALTER TABLE `product` ADD INDEX ( `manufacturer_id` ) ;
ALTER TABLE `product` ADD INDEX ( `sort_order` ) ;
ALTER TABLE `product` ADD INDEX ( `status` ) ;
ALTER TABLE `product_option` ADD INDEX ( `option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `product_option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `product_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `option_id` ) ;
ALTER TABLE `product_option_value` ADD INDEX ( `option_value_id` ) ;
ALTER TABLE `product_tag` ADD INDEX ( `product_id` ) ;
ALTER TABLE `product_tag` ADD INDEX ( `tag` ) ;
ALTER TABLE `url_alias` ADD INDEX ( `query` ) ;
ALTER TABLE `url_alias` ADD INDEX ( `keyword` ) ;
ALTER TABLE `user` ADD INDEX ( `username` ) ;
ALTER TABLE `user` ADD INDEX ( `password` ) ;
ALTER TABLE `user` ADD INDEX ( `email` ) ;
can i use the same method to solve my issue on Version 2.1.0.2? my search results are extremely and take several minutes to show results. pls check charjishop.com and suggest any solution pls. thanks for your valuable advice and support.

Re: [SOLVED] search is very slow

Posted: Sun Feb 09, 2020 11:13 pm
by IP_CAM
The indexing as shown would not work, a DB-Prefix (i.E.: `oc_category`) needs to be part
of each line, if the DB Prefix in your DB is named oc_, otherwise change it to match your setting.
You could also try the Extensions below:
https://www.opencart.com/index.php?rout ... n_id=35767
https://www.opencart.com/index.php?rout ... n_id=26678
https://www.opencart.com/index.php?rout ... n_id=24978
But you also seem to have other problems too, since your Site is loading endless .... :choke:
Ernie