Changeset 21433 for branches


Ignore:
Timestamp:
2012/02/03 11:07:25 (12 years ago)
Author:
Seasoft
Message:

#1626 (SQLチューニングによる商品一覧処理の高速化)

Location:
branches/version-2_12-dev/data/class
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/SC_Product.php

    r21420 r21433  
    7575        $table = <<< __EOS__ 
    7676            dtb_products AS alldtl 
    77             LEFT JOIN dtb_products_class 
    78                 ON alldtl.product_id = dtb_products_class.product_id 
    79             LEFT JOIN dtb_product_categories 
    80                 ON alldtl.product_id = dtb_product_categories.product_id 
    8177__EOS__; 
    8278        $objQuery->setGroupBy('alldtl.product_id'); 
     
    118114        $table = <<< __EOS__ 
    119115            dtb_products AS alldtl 
    120             LEFT JOIN dtb_products_class 
    121                 ON alldtl.product_id = dtb_products_class.product_id 
    122             LEFT JOIN dtb_product_categories 
    123                 ON alldtl.product_id = dtb_product_categories.product_id 
    124 __EOS__; 
    125         $objQuery->setGroupBy('alldtl.product_id'); 
    126         $sql_base = $objQuery->getSql('alldtl.product_id',$table); 
    127         return $objQuery->getOne( "SELECT count(*) FROM ( $sql_base ) as t" , $arrVal); 
     116__EOS__; 
     117        return $objQuery->count($table, '', $arrVal); 
    128118    } 
    129119 
  • branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php

    r21420 r21433  
    269269                if (strlen($searchCondition["where_category"]) >= 1) { 
    270270                    $dtb_product_categories = "(SELECT * FROM dtb_product_categories WHERE ".$searchCondition["where_category"].")"; 
    271                     $arrval_order           = array_merge($searchCondition['arrvalCategory'], $searchCondition['arrvalCategory']); 
     271                    $arrval_order           = $searchCondition['arrvalCategory']; 
    272272                } else { 
    273273                    $dtb_product_categories = 'dtb_product_categories'; 
     
    276276                    ( 
    277277                        SELECT 
    278                              T3.rank 
     278                             T3.rank * 2147483648 + T2.rank 
    279279                        FROM 
    280280                            $dtb_product_categories T2 
     
    285285                        LIMIT 1 
    286286                    ) DESC 
    287                     ,( 
    288                         SELECT 
    289                             T2.rank 
    290                         FROM 
    291                             $dtb_product_categories T2 
    292                             JOIN dtb_category T3 
    293                                 USING (category_id) 
    294                         WHERE T2.product_id = alldtl.product_id 
    295                         ORDER BY T3.rank DESC, T2.rank DESC 
    296                         LIMIT 1 
    297                     ) DESC 
    298                     ,product_id 
     287                    ,product_id DESC 
    299288__EOS__; 
    300289                    $objQuery->setOrder($order); 
     
    425414 
    426415        if (strlen($searchCondition["where_category"]) >= 1) { 
    427             $searchCondition['where'] .= " AND dtb_product_categories.".$searchCondition["where_category"]; 
     416            $searchCondition['where'] .= ' AND EXISTS (SELECT * FROM dtb_product_categories WHERE ' . $searchCondition["where_category"] . ' AND product_id = alldtl.product_id)'; 
    428417            $searchCondition['arrval'] = array_merge($searchCondition['arrval'], $searchCondition['arrvalCategory']); 
    429418        } 
Note: See TracChangeset for help on using the changeset viewer.