【问题标题】:Category page not working Magento 2 with more than 13 million products类别页面无法正常工作 Magento 2 拥有超过 1300 万种产品
【发布时间】:2019-04-25 12:33:58
【问题描述】:

我遇到了一个问题,Magento 2 拥有超过 1300 万种产品。我们已经成功上传了 1300 万个产品,尽管速度很慢,而且它的工作原理类似于索引、产品页面和搜索页面。

在等待近 2 分钟内存耗尽后,我的前端类别页面现在没有打开我们试图分配 18GB 内存,但它卡在此查询上,并且由于内存耗尽错误。

SELECT  1 AS status, e.entity_id, e.attribute_set_id, e.type_id,
        e.created_at, e.updated_at, e.sku,
        cat_index.position AS cat_index_position,
        stock_status_index.stock_status AS is_salable
    FROM  catalog_product_flat_1 AS e
    INNER JOIN  catalog_category_product_index_store1 AS cat_index
           ON cat_index.product_id=e.entity_id
      AND  cat_index.store_id=1
      AND  cat_index.category_id='4'
    INNER JOIN  cataloginventory_stock_status AS stock_status_index
           ON e.entity_id = stock_status_index.product_id
      AND  stock_status_index.website_id = 0
      AND  stock_status_index.stock_id = 1
    WHERE  (stock_status_index.stock_status = 1)

谁能建议我如何克服这个问题或加快进程和 MySQL 查询我应该做哪些架构级别的更改以使其在前端的类别列表页面上工作。我知道这是庞大的数据,但我们需要拥有这么多产品。我们有一个很好的服务器

  • 英特尔至强 E5-2689v4

  • 128 GB 内存

  • 1200 GB 数据存储

    我已经启用了平面目录产品和平面目录类别。

【问题讨论】:

  • 您是否启用了平面目录产品和平面目录类别?您启用了哪种模式?
  • 是的,两者都已启用

标签: mysql performance magento magento2


【解决方案1】:

添加这些复合索引:

stock_status_index:  (stock_status, website_id, stock_id, product_id)
e:  (entity_id)  -- unless that is the PRIMARY KEY
cat_index:  (product_id, store_id, category_id)

如果这些还不够帮助,请提供EXPLAIN SELECT ...SHOW CREATE TABLE

更多索引提示:http://mysql.rjweb.org/doc.php/index_cookbook_mysql

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-04
    • 1970-01-01
    • 2012-06-03
    相关资源
    最近更新 更多