Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Category Products Index Reindexing in CE 2.1.8 takes 1000x longer to run. #10531

Closed
spyrule opened this issue Aug 14, 2017 · 70 comments
Closed
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release

Comments

@spyrule
Copy link

spyrule commented Aug 14, 2017

Re-indexing the Category Products Index takes literally 1000x longer to complete.

In my production environment:

(This is run from 2.1.3)

Category Products indexer has been invalidated.
Category Products index has been rebuilt successfully in 00:01:42

In our Development enivornment (exact copy of Production, upgraded to 2.1.8 only):

Design Config Grid indexer has been invalidated.
Customer Grid indexer has been invalidated.
Product Flat Data indexer has been invalidated.
Category Flat Data indexer has been invalidated.
Category Products indexer has been invalidated.
Product Categories indexer has been invalidated.
Product Price indexer has been invalidated.
Product EAV indexer has been invalidated.
Catalog Rule Product indexer has been invalidated.
Catalog Product Rule indexer has been invalidated.
Catalog Search indexer has been invalidated.
Stock indexer has been invalidated.
Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid index has been rebuilt successfully in 00:00:00
Product Flat Data index has been rebuilt successfully in 00:01:43
Category Flat Data index has been rebuilt successfully in 00:00:00
# > Category Products index has been rebuilt successfully in 03:58:52
Product Categories index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 00:02:31
Product EAV index has been rebuilt successfully in 00:00:55
Catalog Rule Product index has been rebuilt successfully in 00:00:11
Catalog Product Rule index has been rebuilt successfully in 00:00:00
Catalog Search index has been rebuilt successfully in 00:03:15
Stock index has been rebuilt successfully in 00:00:20

Preconditions

  1. Magento CE 2.1.8
  2. php 7.0.22
  3. MySQL v14.14 Distrib 5.6.32-78.1
  4. nginx Hosted service

Steps to reproduce

  1. Large catalog (115K Skus with 50+ Categories) in v.2.1.3
  2. Clear your Indexes, and re-run (should take ~2 minutes for the Category Products Index
  3. Update to 2.1.8 using composer
  4. run setup:upgrade, compile:di, static content,
  5. Reset product indexes
  6. run indexer:reindex
  7. Category Products Index will take several HOURS to complete.

Expected result

  1. Re-index should complete in similar or better time then 2.1.3....

Actual result

  1. Text at start is a direct copy and paste of both 2.1.3 results and 2.1.8 results on the same product/categories.
@orlangur
Copy link
Contributor

Next reindexing with 2.1.8 code will not complete within minutes as well?

@andidhouse
Copy link

andidhouse commented Aug 15, 2017

As there seem again to be more update problems when updating to magento 2.1.8 i ask myself if the magento core team really tested updates from former versions as well?
It is like a red line that new installs are working better then updated magento2 versions - so this should be fixed immediately in my opinion if so.

@spyrule
Copy link
Author

spyrule commented Aug 15, 2017

@orlangur Unfortunately I rolled my test environment back last night, so I can no longer test. However, it shouldn't have taken 4 hours in the first place.

@orlangur
Copy link
Contributor

@spyrule no doubt it should, just wondering whether it's some one-time issue or it works like that always.

@choukalos
Copy link

How many store views & customer groups do you have in the system?

@spyrule
Copy link
Author

spyrule commented Aug 15, 2017

@choukalos 2 websites each with 1 store/store_view, The stock 4 groups.

@ashuston
Copy link

Unfortuantely, I can confirm that I have been experiencing this issue after upgrading to Magento 2.1.8 as well. Re-indexing those two categories never completes for me, whereas before they completed in 6 minutes.

You can find the details of my outlined problem here: https://magento.stackexchange.com/questions/189180/magento-2-1-8-reindex-timeout

@andidhouse
Copy link

Same here - this leaves us speechless. We can not stay with 2.1.7 because this version does not work right with PayPal express and also indexing is false in 2.1.7 - and upgrading to 2.1.8 is not possible because of this issue.

This really leaves us speechless.

@spyrule
Copy link
Author

spyrule commented Aug 16, 2017

This should almost be an emergency patch for 2.1.8.

@andidhouse
Copy link

The @magento-team promised to built a more stable system over the last 6-9 month. We really do not know what to say about the massive update problems reported here and experienced in our systems.

@ashuston
Copy link

I second the urgency of a patch to fix this VERY important issue. Our stores won't work properly or operate at all if indexing isn't working.

@andidhouse
Copy link

@vherasymenko @orlangur can you pls adress this a a priority one major bug to the development team now - the system is not usable without indexing.

I think this should be investigated and a quick fix should be delivered now - not in days, not in weeks.

@nikoelgatito
Copy link
Contributor

nikoelgatito commented Aug 16, 2017

We are experiencing the same issue with a catalog containing over 100k products and around 1000 categories with multiple store views. In our case it seems that 8 hours is still not sufficient to complete the task. We unfortunately killed the process before it reaches completion as we thought it was stuck somewhere in the process. When we tried again, we used strace and we realized that it is in fact iterating very slowly, looping over a query batch.

There is an extract of one of these queries:

INSERT INTO `catalog_category_product_index` (`category_id`, `product_id`, `position`, `is_parent`, `store_id`, `visibility`) SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, ccp.position + 10000 AS `position`, 0 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `temp_catalog_category_tree_index_509524ae` AS `cc2` ON cc2.parent_id = cc.entity_id AND cc.entity_id NOT IN (1)
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc2.child_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.entity_id = cpe.entity_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 97
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.entity_id = cpe.entity_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.entity_id = cpe. entity_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 99
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.entity_id = cpe.entity_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1
 INNER JOIN `catalog_category_entity_int` AS `ccad` ON ccad.entity_id = cc.entity_id AND ccad.store_id = 0 AND ccad.attribute_id = 54
 LEFT JOIN `catalog_category_entity_int` AS `ccas` ON ccas.entity_id = cc.entity_id AND ccas.attribute_id = ccad.attribute_id AND ccas.store_id = 1 WHERE (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) AND (IFNULL(ccas.value, ccad.value) = 1) ORDER BY `cc`.`entity_id` ASC
 LIMIT 329500 OFFSET 500 ON DUPLICATE KEY UPDATE `category_id` = VALUES(`category_id`), `product_id` = VALUES(`product_id`), `position` = VALUES(`position`), `is_parent` = VALUES(`is_parent`), `store_id` = VALUES(`store_id`), `visibility` = VALUES(`visibility`)

It is unfortunate as we just upgraded from our 2.1.6 version that was also not reindexing as it should. We had a "functional" way to reindex the catalog_product_category and catalog_category_product indexes once patched manually to overcome the 500 products per category bug #8018.

The fix applied by Magento to resolve the 500 limit issue in 2.1.8 seems to be the culprit of this new bug.

Comments:

It might be a good idea to add a configuration allowing to set the batch size from the backend advanced configurations. This way every store owner would be able to adjust the performance/recource consomption ratio for the reindexing process. The relation between the server capacity (memory/CPU) and catalog size vary greatly among Magento users and I think that there is no "one size fits all".

@boxyman
Copy link

boxyman commented Aug 17, 2017

I have notice that using the fix in #8018 The reindex completes with no errors. But the problem it fixed in Magento 2.1.7 became unfixed. So It really doesn't help that much :/

@dersam
Copy link

dersam commented Aug 17, 2017

We are having the same issue with a 300k+ sku catalog.

@boxyman
Copy link

boxyman commented Aug 18, 2017

It seems i stumble upon some kind of solution. I am not sure what I did but I will tell you what I remember doing.

  1. Enable maintenance mode: bin/magento maintenance:enable
  2. Reset indexes: bin/magento indexer:reset
  3. Make sure that no database processes regarding indexing is running
    1. Open your database administration client like PHPmyadmin
    2. Run query: SHOW PROCESSLIST;
    3. Run query: KILL QUERY xxxxx (where xxxxx is the ID of processes you want to kill)
  4. bin/magento setup:upgrade
  5. Clear cache
  6. bin/magento setup:static-content:deploy -j 1
  7. bin/magento indexer:reindex
  8. Disable maintenance mode: bin/magento maintenance:disable

Now the only thin missing is some of the product images on the category page. The weird thing is that if i go to the product page I can see the product image. There are also a small version in the cache folder.

@andidhouse
Copy link

andidhouse commented Aug 18, 2017

@alankent are you aware what is going on here with the development? I thought you promised over a year ago to improve the bug tracking process and aim for a much more stable system?

Could you pls explain what is going on with the magento2 development team since now over 2 years? Every release and update contains hundreds of new and old bugs. At the moment you can not even upgrade to 2.1.8 - also you can not stay at 2.1.7 because of the known major bugs (for example PayPal bugs).

It seems that this does not go the right direction.
Could you pls give us a feedback here.

@mounish
Copy link

mounish commented Aug 18, 2017

Same issue with us too. We had store running very well on 2.1.2 Enterprise Edition. Product flat reindexing used to take hardly 30 seconds for our catalog size of 25000 + products.

We upgraded to 2.1.7 last week, and reindex now takes around 30+ minutes.

Also category product count issue which was not there earlier got introduced.

Magento Enterprise support is worst in this case. Seems we are wasting $20000 every year for the same. As most of the time they dont even know the issues and 90% of issues never got solved from them. They just keep on asking for data access, once given, they keep on asking for mysql / php global variables. We had store running very well since a year, and all of the sudden on upgrading site stops functioning well.

Any idea / solution for the same would be appreciated.

Thanks

@ashuston
Copy link

This problem is serious and still on-going. Can we please get a response about the possibility of a fix, and how soon it will be available?

@abovebar
Copy link

we are having the same problem on a store with 330k+ products and 500+ categories, last week the reindex took roughly 24 hours, this week after the addition of 1,000,000 category filters the reindex is still running after 24 hours... worst part is that the products drop out during reindex and it halts dev... need a fix quick!!!

@korostii
Copy link
Contributor

Hi @vherasymenko, Hi @choukalos,
Is there any progress investigating this so far?

Should we expect a fast fix in the next few days?

Or is this rather a bigger complex issue with no fix expected in the foreseeable future? In such case kind of patch or a workaround would be quite useful.

Would you recommend to stay on\roll back to 2.1.7 for the time being instead?

@andidhouse
Copy link

@korostii i think you can not expect a quick fix, workaround or patch from the magento team. This never happened on magento version 2 as far as i know.

The "normal" process of tickets here is the magento team creates an internal ticket and then it takes in the best case 3-6 month - in the normal case 6-18 month until a fix is provided with a new release.

So i would not suggest to hope that the magento2 team is providing help here at all.

@korostii
Copy link
Contributor

best case 3-6 month

I would have to respectfully disagree.
When 2.1.6 introduced a new major issue with catalog images' resizing, that issue was patched in 2.1.7 which got released in under 2 months after that (Apr 11 ... May 31). That's rather quick, by Magento standards.

Similar approach might be appropriate here, especially considering that the 2.1.9 version seems to be reserved and the current "next" patch version being actively worked on is 2.1.10: http://take.ms/L22ud

@andidhouse
Copy link

@korostii thanks for your input - this is one bug solved fast. Pls have a look at about 200-300 bugs reported here which are not fixed since 12-18 month - maybe longer.

In my opinion you can not say that you can expect to fix this fast because another bug was also fixed fast. You have to take the average time here a bug is fixed and this is in my opinion not 1-3 month but 6-18 month.

You can find a lot of examples here on GitHub of reported bugs not solved for over 1 year.
So lets hope this gets faster but for now i do not expect it to.

@hankzhh
Copy link

hankzhh commented Aug 30, 2017

It looks like there will be no fix in v2.1.* officially. The best case it will suggest you upgrade to v2.2.

  1. If you check the v2.2 's source code: https://github.com/magento/magento2/blob/2.2/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php. There is a different idea there.
    BTW: I don't think "RANGE_CATEGORY_STEP = 500;' with php loop is a good way to handle performance issue.

  2. In v2.1 source code, there is a logic error: the code set "$useTempTable = false;" and this will delete all the records first in product index table once the reindex process begins. This doesn't happen in v2.0 and v2.2, only happen after v2.1.3. I also create an issue many days ago: reindex take too much time for some query #10506
    So i guess there is a serious issue there. Even no internal ticket number assigned to this.

@korostii
Copy link
Contributor

@andidhouse, Yes, I do know at which most of the average-priority bugs move around here.
That is not the point.

What I am saying is that this is no ordinary bug and the Magento guys could for once show they are able to move fast when it's deemed necessary. If such a massive issue introduced in a patch release is not the time time to do that, I do not know what is (a security hole? broken checkout?).
IMHO Massive performance issue is exactly the same magnitude as that catalog resize issue.

I think this issue deserves attention and should've been fixed in under a week in 2.1.8.1 or whatever like a week ago unless there're any complications to it.
I'd expect the Magento team to answer for themselves: is this being dealt with, is there any progress, any update on this point in a timely manner. Otherwise the usual longing silence will be my answer.

I know @orlangur might argue that Magento doesn't need short development/bugfixing cycles and it's okay and fine and bug-free as long as it's covered by all those automatic tests... Well, how come that testing didn't catch this bug prior to release? =)

@andidhouse
Copy link

@korostii - totally agree with you that this needs priority one to fix by the magento team.
But there never was a "quick fix" or whatever you want to call it in the whole lifetime of magento2 - and this is why i do not think magento will provide one.

I also totally agree with the priority of this one with you - if not now when?

But to be honest we learnt the last 1.5 years that no quick help is supported by the magento2 team at all - no matter which bugs they produce or which version they release.

And this is why i think nothing will happen here for the next weeks - which is a shame.

@ashuston
Copy link

@orlangur Yes, I was wondering if 2.2 fixed this indexing bug. I am worried about upgrading and breaking the indexing again. At least the other fix works for now..

@am2008
Copy link

am2008 commented Sep 29, 2017

@orlangur Влад, если есть желание, можем обсудить. Нужен контакт.

@abovebar
Copy link

i have installed 2.2 but am seeing a few errors i believe are related to some extensions that i have installed... other than that all seems to be working well

@am2008
Copy link

am2008 commented Oct 5, 2017

Before 2.2 release price indexing was "invisible". In 2.2 it takes very long time.

@magento-engcom-team
Copy link
Contributor

@spyrule, thank you for your report.
The issue is already fixed in 2.2.0

@kervin
Copy link

kervin commented Oct 12, 2017

Will this be ported to 2.1.10?

@sshymko
Copy link

sshymko commented Nov 1, 2017

I can confirm the workaround isRangingNeeded() { return false; } provided above by @ashuston fixes the issue on 2.1.9!

@behnamshayani
Copy link
Contributor

behnamshayani commented Nov 1, 2017

the fix for (2.1.8, 2.1.9, 2.1.10):
magento/framework/DB/Query/BatchRangeIterator.php::184
wrong:

$object->limit($this->currentBatch, $this->batchSize);

correct:

$object->limit($this->batchSize, $this->currentBatch);

wrong code produces, which is exponentially slower than non-range indexing:

SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 
SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 500 OFFSET 500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 1000 OFFSET 500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 1500 OFFSET 500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 2000 OFFSET 500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 2500 OFFSET 500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 3000 OFFSET 500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 3500 OFFSET 500

correct code produces:

SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 500 OFFSET 500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 500 OFFSET 1000
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 500 OFFSET 1500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 500 OFFSET 2000
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 500 OFFSET 2500
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 500 OFFSET 3000
  
 SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, `ccp`.`position`, 1 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
 INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc.entity_id
 INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
 INNER JOIN `catalog_product_entity` AS `cpe` ON ccp.product_id = cpe.entity_id
 INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.row_id = cpe.row_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 84
 LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.row_id = cpe.row_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
 INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.row_id = cpe.row_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 91
 LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.row_id = cpe.row_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/381/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) ORDER BY `cc`.`entity_id` ASC
 LIMIT 500 OFFSET 3500

But this still misses the last batch in the range so if you want ranging enabled you need to change:
magento/framework/DB/Query/BatchRangeIterator.php::128

$this->isValid = ($this->batchSize + $this->currentBatch) < $this->totalItemCount;

To:

$this->isValid = $this->currentBatch < $this->totalItemCount;

To check, apply fixes and compare number of products in "catalog_category_product_index" with isRangingNeeded() returning false and true, both cases should result same number of products in table

@shyang292
Copy link

@ashuston your method works for my server. you save my whole day. Thanks a bunch

@sshymko
Copy link

sshymko commented Nov 2, 2017

The issue (and the fix) is similar to #8018.

@sshymko
Copy link

sshymko commented Nov 2, 2017

Why was the ticket closed? Where's the official fix?

@drew7721
Copy link
Member

I really don't see why this issue was closed. As mentioned by @am2008 the price indexer takes FOREVER in 2.2.1. It's been running for over 24 hours and still going. (350K+ products)

@vrann
Copy link
Contributor

vrann commented Nov 15, 2017

reported that it is reproduced on 2.2.1

@vrann vrann reopened this Nov 15, 2017
@tomasinchoo
Copy link

tomasinchoo commented Nov 16, 2017

I am running M 2.2.1.
PHP 7.1.9 /MariaDB 10.1.26
Migrated succesfuly from 1.14.2.1 EE.
Price indexer is running more than 27 hours so far...
136775 products and 7 websites.

i7-7700HQ / 16GB RAM /m.2 SSD

It used to run 58 minutes top on 2.1.9

I don't know what to say :(

EDIT: My laptop is so loud atm that I'm not sure how will I sleep tonight :D

@am2008
Copy link

am2008 commented Nov 16, 2017

Price reindex time = X * customer_groups. An almost direct dependence is observed. For example: if you have 10 customer groups and you using only 3, try delete unused groups and get x7 boost. Here 1M+ skus reindex log:
Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid index has been rebuilt successfully in 00:00:00
Product Flat Data index has been rebuilt successfully in 00:02:04
Category Products index has been rebuilt successfully in 00:06:06
Product Categories index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 01:03:08
Product EAV index has been rebuilt successfully in 00:01:28
Catalog Rule Product index has been rebuilt successfully in 00:00:00
Catalog Product Rule index has been rebuilt successfully in 00:00:00
Catalog Search index has been rebuilt successfully in 01:38:51
Stock index has been rebuilt successfully in 00:00:57

This is a blank database(without the use of reindex). If suddenly the reindex process terminated(electricity or the internet was gone), subsequent reindexing turns into a nightmare, as @tomasinchoo described.

@behnamshayani
Copy link
Contributor

why are you guys talking about price index in this issue? This originally was about category_product index.
And seems like issue with category_product is fixed in 2.2.0 and 2.2.1 (but not in 2.1.9, 2.1.10)
2.2.1 on my local machine, 495K sku, 3k category, 7 website:

(/var/www/magento221)$ bin/magento setup:perf:generate-fixtures /private/var/www/magento221/setup/performance-toolkit/profiles/ce/large.xml
Generating profile with following params:
|- Websites: 7
|- Store Groups Count: 7
|- Store Views Count: 7
|- Categories: 3000
|- Attribute Sets (Default): 3
|- Attribute Sets (Extra): 10
|- Simple products: 300000
|- Configurable products: 8000
|- Product images: 2000, 3 per product
|- Customers: 50
|- Cart Price Rules: 10
|- Orders: 100
Config Changes... done in 00:00:00
Generating admin users... done in 00:00:00
Generating websites, stores and store views... done in 00:00:08
Generating categories... done in 00:04:22
Generating attribute sets... done in 00:00:12
Generating simple products... done in 00:16:31
Generating configurable EAV variations... done in 00:00:00
Generating bundle products... done in 00:00:00
Generating configurable products... done in 00:08:34
Generating images... done in 00:00:00
Generating customer groups... done in 00:00:00
Generating customers... done in 00:00:00
Generating cart price rules... done in 00:01:24
Generating catalog price rules... done in 00:00:00
Generating tax rates... done in 00:00:00
Generating tax rules... done in 00:00:00
Generating orders... done in 00:00:00
Indexers Mode Changes... done in 00:00:00
Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid index has been rebuilt successfully in 00:00:00
Category Products index has been rebuilt successfully in 00:15:07
Product Categories index has been rebuilt successfully in 00:00:00

if there is issue with price index another issue should be created imo.

@udovicic
Copy link
Member

udovicic commented Nov 29, 2017

Problem with price indexer is hard to detect on new installations, as core of the problem is with batch calculator and estimating page sizes. Instead of counting how many products there are and using that to calculate pages, batch calculator relies on the highest product id. Meaning that if you have single product with id 1000001 you will have a lot of indexing operations for nothing. Further to that, price values are calculated on (almost) every iteration so the problem is quantity of operations. Sugar on top, batch size is terribly low.

Ugly hack around would be to adjust batch size here so that you are sure it will take all products at once. That means that it will do only 8 calculations (8 indexer types), which is much faster. And by much faster I mean finishing within 1-2min compared to not being able to complete the job even after 2 days of working.

@magento-engcom-team magento-engcom-team added Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release labels Dec 14, 2017
@Anantkprajapati
Copy link

Anantkprajapati commented Mar 18, 2018

Working fine reindexing with 4,00,000+ products in magento 2.1.9 after change @ashuston comment.

thanks guys

@benyanke
Copy link

benyanke commented Mar 27, 2018

Anyone have a fix working for 2.0.6?

@pmathbliss
Copy link

The batch calculation is not fixed in 2.2.x. The batches still walk through all the ids even if there are no entities in that batch.i watched the price indexer try to reindex bundles, batch at a time when there are no batches on the site. There are queries that select * from catalog product entity where entity_id between 100 and 200 (depending on the batch size)
They reindex should use the change logs. Select a list of all the current product types and then batch through the list. This would process through even sized list chunks.

I briefly looked at 2.3.x and it appear the price index is changed. Has this been fixed properly?

@ghost ghost mentioned this issue Nov 6, 2018
@mikekenyon99
Copy link

mikekenyon99 commented Nov 6, 2018

Hi, I am having this issue on 2.2.6, Im new to GitHub so not sure what I need to do make you guys look at this?

Mike

Preconditions (*)

  1. Magento 2.2.6
  2. PHP 7.0

Steps to reproduce (*)

  1. Load 40k of products, 100 attributes
  2. Run php bin/magento indexer:reindex
  3. Load 40k of products
  4. Run php bin/magento indexer:reindex

Expected result (*)

  1. Indexes should build in reasonable time.

Actual result (*)

  1. All indexes build in under <1 min but the product EAV one does not. I have given it 24 to 48 hours but nothing happens.
  2. I posted here on Stack Overflow, https://magento.stackexchange.com/questions/238840/product-eav-index, but never got a reponse.

I could really do with some help to diagnose what is going on here. Where should I look for more information? All help greatly appreciated.

Mike

@gulshan-streammarket
Copy link

Magento 2.2.7 has feature to disable product eav attribute indexing when not using MySql as search engine. Most of the vendor's have large catalog and they prefer fast searching with external search engine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release
Projects
None yet
Development

No branches or pull requests