magento 使用flat 表
来源:互联网 发布:手机晒密软件 编辑:程序博客网 时间:2024/04/25 07:55
转载地址:http://inchoo.net/ecommerce/magento/flat-tables-in-magento-and-product-collection/
Flat tables in Magento and product collection
You probaly know that Magento uses EAV database structure for categories, products. In some cases this solution is not the best or fastest.
I will get you here example how to speed up product collection. Magento has config option: “Use Flat Catalog Product”. In order to see this option, go to Magento admin section and click on: System -> Config -> Catalog and Frontend.
If you enable this option, you will adjust Magento to use “Flat resource” for product collection. Take a look at product collection class “Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection” you will see a method “_construct“.
protected
function
_construct()
{
if
(
$this
->isEnabledFlat()) {
$this
->_init(
'catalog/product'
,
'catalog/product_flat'
);
}
else
{
$this
->_init(
'catalog/product'
);
}
$this
->_initTables();
}
If flat is enabled in Magento admin section, collection will use resource: ‘catalog/product_flat’, php class “Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Flat”
without EAV database structure. SQL queries will be simplier, faster and you would need to have better performance on product listing.
In this Flat resource there is method:
public
function
getMainTable() {
return
$this
->getFlatTableName(
$this
->getStoreId());
}
This method returns flat table name and it depends about current store. Flat table name for store_id “1″ is “catalog_product_flat_1“, below you can see method which is in charge for giving current table name.
public
function
getFlatTableName(
$store
= null)
{
if
(
is_null
(
$store
)) {
$store
=
$this
->getStoreId();
}
return
$this
->getTable(
'catalog/product_flat'
) .
'_'
.
$store
;
}
For every store you will have one flat table.
- magento 使用flat 表
- Magento: Describing Flat Catalog
- magento flat和eav表连接的不同
- magento 获取flat表记录
- Magento 快速保存产品属性的代码 - 不能更新flat表
- Category Flat Data - Can’t initialize indexer process magento
- numpy.chararray.flat的使用
- magento ----使用magento内部机制建立数据库表
- automake的flat和shadow详细使用
- magento -- 如何设置使用magento的优惠券
- magento----使用magento机制安装数据表
- EXSI 5.5 虚拟机,使用*-flat.vmdk恢复的方法
- magento使用google analytics
- Magento中使用MemCached
- magento img 标签 使用
- 使用magento的分页
- magento如何使用session
- magento addattributetoselect使用
- 使用程序动态创建账户组合
- Java printf : 格式化输出的功能
- MAT(Memory Analyzer Tool)工具入门介绍
- 中文字符返回的时出现乱码
- (standard c libraries translation)alloca
- magento 使用flat 表
- 定制导出oracle语句
- 静态检查------SourceMonitor的学习和使用
- 平安夜 送自己一个小博客
- Ubuntu配置jre环境
- 获取内核磁盘设备卷标名 QueryDosDevice()
- cmake 从入门到精通(一)
- USACO注意的小细节
- CUDA程序优化小记(二)