数据库瘦身

来源:互联网 发布:域名过期时间查询 编辑:程序博客网 时间:2024/04/28 23:32

网站搜索没有必要结果

\app\code\core\Mage\CatalogSearch\Model\Resource\Fulltext.php

注释掉

/*            $sql = $adapter->insertFromSelect($select,                $this->getTable('catalogsearch/result'),                array(),                Varien_Db_Adapter_Interface::INSERT_ON_DUPLICATE);            $adapter->query($sql, $bind);*/

提交订单的时候更新库存,也务必要

SQL: SELECT SUM(order_items.qty_ordered) AS `ordered_qty`, `order_items`.`name` AS `order_items_name`, `order_items`.`product_id` AS `entity_id`, `e`.`entity_type_id`, `e`.`attribute_set_id`, `e`.`type_id`, `e`.`sku`, `e`.`has_options`, `e`.`required_options`, `e`.`crea
ted_at`, `e`.`updated_at`, `flat`.`name`, `flat`.`small_image`, `flat`.`price`, `flat`.`special_price`, `flat`.`special_from_date`, `flat`.`special_to_date`, `cat_index`.`position` AS `cat_index_position`, `at_inventory_in_stock`.`is_in_stock` AS `inventory_in_stock` FR
OM `sales_flat_order_item` AS `order_items`
 INNER JOIN `sales_flat_order` AS `order` ON `order`.entity_id = order_items.order_id AND `order`.state <> 'canceled'
 LEFT JOIN `catalog_product_entity` AS `e` ON (e.type_id NOT IN ('grouped', 'configurable', 'bundle')) AND e.entity_id = order_items.product_id AND e.entity_type_id = 4
 LEFT JOIN `catalog_product_flat_6` AS `flat` ON (e.entity_id = flat.entity_id ) 
 INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id='6' AND cat_index.visibility IN(2, 4) AND cat_index.category_id='261'
 INNER JOIN `cataloginventory_stock_item` AS `at_inventory_in_stock` ON (at_inventory_in_stock.`product_id`=e.entity_id) AND ((at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=1 AND at_inventory_in_stock.is_in_stock=1) OR (at_inve
ntory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=0) OR (at_inventory_in_stock.use_config_manage_stock = 1 AND at_inventory_in_stock.is_in_stock=1)) WHERE (parent_item_id IS NULL) GROUP BY `order_items`.`product_id` HAVING (SUM(order_item
s.qty_ordered) > 0) ORDER BY `ordered_qty` desc, `cat_index`.`position` ASC LIMIT 25 OFFSET 25
AFF: 25
TIME: 0.1750

非常耗时,在后台禁用

catalog/Inventory


0 0