cataloginventory_stock_status_idx表的意义是什么? [英] What's the point of the cataloginventory_stock_status_idx table?

查看:116
本文介绍了cataloginventory_stock_status_idx表的意义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经非常努力地理解cataloginventory_stock的关系-我确实知道修改库存项目时stock_item表和stock_status表都会更新,但是我无法弄清楚stock_status_idx表是否真的必需的.

I have tried really hard to understand the cataloginventory_stock relations - I do know that both the stock_item as well as stock_status tables get updated when a stock item gets modified, but I wasn't able to figure out whether the stock_status_idx table is really required.

据我所知,stock_status_idx表包含与stock_status表相同的信息.它只是临时表吗?如果我手动更新了stock_item和stock_status表,但是没有看到错误的库存状态的任何问题,但是没有更新stock_status_idx表.

From what I can see, the stock_status_idx table contains the same information as the stock_status table. Is it a temporary table only? I did not see any problems with wrong stock status if I manually updated the stock_item and stock_status tables, but did not update the stock_status_idx table.

问题是..我认为它已以某种方式用于缓存/索引器.但是,即使我没有修改stock_status_idx表,库存状态也可以在后端和前端很好地显示.

The thing is.. I thought it's somehow used for caching/the indexer. However, even if I didn't modify the stock_status_idx table, the stock status displayed just fine in the backend and in the frontend.

那么,stock_status_idx表的意义是什么?

So, what's the point of the stock_status_idx table?

非常感谢您的帮助.

推荐答案

我想知道同一个问题,因此决定挖洞,因为我在任何地方都找不到答案. 似乎_tmp和_idx用作索引数据的临时持有人.

I was wondering the same question and decided to dig as I could not find an answer anywhere. It seems like the _tmp and _idx are used as temp holders for your indexed data.

例如,您可以查看app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php中的reindexAll()方法,您将了解它在生成索引时使用_idx表临时存储其数据:

For example, you can look at the reindexAll() method in app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php and you will understand that it is using _idx tables to temporarily store it's data when generating the indexes:

$this->useIdxTable(true);
...
$idxTable = $this->getIdxTable();
....
$query = $select->insertFromSelect($idxTable, ...

在同一方法的结尾,您会注意到一个不错的$this->syncData()方法调用.您可能猜对了!该函数位于app/code/core/Mage/Index/Model/Resource/Abstract.php中并正在执行此操作,将_idx与main同步:

At the end of the same method you will notice a nice $this->syncData() method call. You probably guessed it! The function lives in app/code/core/Mage/Index/Model/Resource/Abstract.php and is doing just that, syncs the _idx with main:

$this->_getWriteAdapter()->delete($this->getMainTable());
$this->insertFromTable($this->getIdxTable(), $this->getMainTable(), false);
$this->commit();

祝你好运!

这篇关于cataloginventory_stock_status_idx表的意义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆