Changeset 17939 for branches/version-2_4


Ignore:
Timestamp:
2009/03/27 16:18:58 (15 years ago)
Author:
kajiwara
Message:

#436 MySQLの高速化対応。MySQL4.1 MySQL5 で検証済。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_4/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php

    r17930 r17939  
    365365                ON T1.product_id = T2.product_id_sub) ', 
    366366 
    367             "vw_products_allclass" => ' 
    368    (SELECT T1.product_id, 
    369            product_code_min, 
    370            product_code_max, 
    371            price01_min, 
    372            price01_max, 
    373            price02_min, 
    374            price02_max, 
    375            stock_min, 
    376            stock_max, 
    377            stock_unlimited_min, 
    378            stock_unlimited_max, 
    379            del_flg, 
    380            status, 
    381            name, 
    382            comment1, 
    383            comment2, 
    384            comment3, 
    385            main_list_comment, 
    386            main_image, 
    387            main_list_image, 
    388            product_flag, 
    389            deliv_date_id, 
    390            sale_limit, 
    391            point_rate, 
    392            sale_unlimited, 
    393            create_date, 
    394            deliv_fee, 
    395            rank 
    396            ,(SELECT rank AS category_rank 
    397                FROM dtb_category AS T4 
    398               WHERE T1.category_id = T4.category_id) as category_rank 
    399            ,(SELECT category_id AS sub_category_id 
    400                FROM dtb_category T4 
    401               WHERE T1.category_id = T4.category_id) as category_id 
    402       FROM (SELECT T0.product_id, 
    403                    T0.del_flg, 
    404                    T0.status, 
    405                    T0.name, 
    406                    T0.comment1, 
    407                    T0.comment2, 
    408                    T0.comment3, 
    409                    T0.main_list_comment, 
    410                    T0.main_image, 
    411                    T0.main_list_image, 
    412                    T0.product_flag, 
    413                    T0.deliv_date_id, 
    414                    T0.sale_limit, 
    415                    T0.point_rate, 
    416                    T0.sale_unlimited, 
    417                    T0.create_date, 
    418                    T0.deliv_fee, 
    419                    T00.category_id, 
    420                    T00.rank 
    421               FROM dtb_products AS T0 
    422          LEFT JOIN dtb_product_categories AS T00 
    423              USING (product_id)) AS T1 
    424 RIGHT JOIN (SELECT product_id as product_id_sub, 
    425                    MIN(product_code) AS product_code_min, 
    426                    MAX(product_code) AS product_code_max, 
    427                    MIN(price01) AS price01_min, 
    428                    MAX(price01) AS price01_max, 
    429                    MIN(price02) AS price02_min, 
    430                    MAX(price02) AS price02_max, 
    431                    MIN(stock) AS stock_min, 
    432                    MAX(stock) AS stock_max, 
    433                    MIN(stock_unlimited) AS stock_unlimited_min, 
    434                    MAX(stock_unlimited) AS stock_unlimited_max 
    435               FROM dtb_products_class GROUP BY product_id) AS T2 
    436                 ON T1.product_id = T2.product_id_sub 
    437             ) ', 
     367        "vw_products_allclass" => ' 
     368               (SELECT 
     369                    T2.product_id 
     370                    ,T1.product_code_min 
     371                    ,T1.product_code_max 
     372                    ,T1.price01_min 
     373                    ,T1.price01_max 
     374                    ,T1.price02_min 
     375                    ,T1.price02_max 
     376                    ,T1.stock_min 
     377                    ,T1.stock_max 
     378                    ,T1.stock_unlimited_min 
     379                    ,T1.stock_unlimited_max 
     380                    ,T2.del_flg 
     381                    ,T2.status 
     382                    ,T2.name 
     383                    ,T2.comment1 
     384                    ,T2.comment2 
     385                    ,T2.comment3 
     386                    ,T2.main_list_comment 
     387                    ,T2.main_image 
     388                    ,T2.main_list_image 
     389                    ,T2.product_flag 
     390                    ,T2.deliv_date_id 
     391                    ,T2.sale_limit 
     392                    ,T2.point_rate 
     393                    ,T2.sale_unlimited 
     394                    ,T2.create_date 
     395                    ,T2.deliv_fee 
     396                    ,T3.rank 
     397                    ,T4.rank AS category_rank 
     398                    ,T4.category_id 
     399                FROM 
     400                    ( 
     401                        (dtb_products AS T2 RIGHT JOIN 
     402                            (SELECT 
     403                                product_id AS product_id_sub 
     404                                ,MIN(product_code) AS product_code_min 
     405                                ,MAX(product_code) AS product_code_max 
     406                                ,MIN(price01) AS price01_min 
     407                                ,MAX(price01) AS price01_max 
     408                                ,MIN(price02) AS price02_min 
     409                                ,MAX(price02) AS price02_max 
     410                                ,MIN(stock) AS stock_min 
     411                                ,MAX(stock) AS stock_max 
     412                                ,MIN(stock_unlimited) AS stock_unlimited_min 
     413                                ,MAX(stock_unlimited) AS stock_unlimited_max 
     414                            FROM dtb_products_class GROUP BY product_id 
     415                            ) AS T1 ON T1.product_id_sub = T2.product_id 
     416                        ) LEFT JOIN dtb_product_categories AS T3 ON T2.product_id = T3.product_id 
     417                    ) LEFT JOIN dtb_category AS T4 ON T3.category_id = T4.category_id 
     418                ) ', 
    438419 
    439420            "vw_products_allclass_detail" => ' 
Note: See TracChangeset for help on using the changeset viewer.