VS

Size: a a a
VS
А
А
А
А
VS
А
VS
cscart_products_categories
(product_id
mediumint unsigned NOT NULL DEFAULT '0',category_id
mediumint unsigned NOT NULL DEFAULT '0',link_type
char(1) NOT NULL DEFAULT 'M',position
smallint unsigned NOT NULL DEFAULT '0',category_position
smallint unsigned NOT NULL DEFAULT '0',category_id
,product_id
),link_type
(link_type
),pt
(product_id
,link_type
)VS
VS
VS
cscart_categories
(category_id
mediumint unsigned NOT NULL AUTO_INCREMENT,parent_id
mediumint unsigned NOT NULL DEFAULT '0',id_path
varchar(255) NOT NULL DEFAULT '',level
int unsigned NOT NULL DEFAULT '1',company_id
int unsigned NOT NULL DEFAULT '0',usergroup_ids
varchar(255) NOT NULL DEFAULT '0',status
char(1) NOT NULL DEFAULT 'A',product_count
mediumint unsigned NOT NULL DEFAULT '0',position
smallint unsigned NOT NULL DEFAULT '0',timestamp
int unsigned NOT NULL DEFAULT '0',is_op
char(1) NOT NULL DEFAULT 'N',localization
varchar(255) NOT NULL DEFAULT '',age_verification
char(1) NOT NULL DEFAULT 'N',age_limit
tinyint NOT NULL DEFAULT '0',parent_age_verification
char(1) NOT NULL DEFAULT 'N',parent_age_limit
tinyint NOT NULL DEFAULT '0',selected_views
text,default_view
varchar(50) NOT NULL DEFAULT '',product_details_view
varchar(50) NOT NULL DEFAULT '',product_columns
tinyint unsigned NOT NULL DEFAULT '0',is_trash
char(1) NOT NULL DEFAULT 'N',yml2_market_category
varchar(255) NOT NULL,yml2_offer_type
varchar(32) NOT NULL DEFAULT '',yml2_type_prefix_select
varchar(32) NOT NULL DEFAULT '',yml2_model_select
varchar(32) NOT NULL DEFAULT '',yml2_type_prefix
varchar(64) NOT NULL DEFAULT '',yml2_model
varchar(64) NOT NULL DEFAULT '',external_id
varchar(128) NOT NULL DEFAULT '',ab__lc_catalog_image_control
char(5) NOT NULL DEFAULT 'none',ab__lc_landing
char(1) NOT NULL DEFAULT 'N',ab__lc_subsubcategories
int NOT NULL DEFAULT '0',ab__lc_menu_id
int NOT NULL DEFAULT '0',ab__lc_how_to_use_menu
char(1) NOT NULL DEFAULT 'N',ab__lc_inherit_control
char(1) NOT NULL DEFAULT 'N',delivery_cat_id
int NOT NULL DEFAULT '0',category_id
),category_id_UNIQUE
(category_id
),c_status
(usergroup_ids
,status
,parent_id
),position
(position
),parent
(parent_id
),id_path
(id_path
),localization
(localization
),age_verification
(age_verification
,age_limit
),parent_age_verification
(parent_age_verification
,parent_age_limit
),idx_fshare
(category_id
,company_id
,usergroup_ids
,status
) USING BTREE,p_category_id
(category_id
,usergroup_ids
,status
) USING BTREEА
SELECT products.product_id3. EXPLAIN этого запроса показать
, IF(shared_descr.product_id IS NOT NULL, shared_descr.product, descr1.product) as product
, products.product_type
, products.parent_product_id
, cscart_discussion.type AS discussion_type
, cscart_discussion.thread_id AS discussion_thread_id
, AVG(cscart_discussion_rating.rating_value) AS average_rating
FROM cscart_products as products
LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id AND descr1.lang_code = 'ru'
INNER JOIN cscart_product_prices as prices ON prices.product_id = products.product_id AND prices.lower_limit = 1
INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id
INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id
AND (cscart_categories.usergroup_ids = '' OR FIND_IN_SET(0, cscart_categories.usergroup_ids) OR FIND_IN_SET(1, cscart_categories.usergroup_ids))
AND cscart_categories.status IN ('A', 'H')
LEFT JOIN cscart_ult_product_descriptions shared_descr ON shared_descr.product_id = products.product_id
AND shared_descr.company_id = 1
AND shared_descr.lang_code = 'ru'
LEFT JOIN cscart_discussion ON cscart_discussion.object_id = products.product_id
AND cscart_discussion.object_type = 'P'
LEFT JOIN cscart_discussion_posts ON cscart_discussion_posts.thread_id = cscart_discussion.thread_id
AND cscart_discussion_posts.status = 'A'
LEFT JOIN cscart_discussion_rating ON cscart_discussion.thread_id = cscart_discussion_rating.thread_id
AND cscart_discussion_rating.post_id = cscart_discussion_posts.post_id
AND cscart_discussion_rating.rating_value != 0
WHERE 1
AND cscart_categories.company_id = 1
AND (products.usergroup_ids = ''
OR FIND_IN_SET(0, products.usergroup_ids)
OR FIND_IN_SET(1, products.usergroup_ids)
)
AND products.status IN ('A')
AND prices.usergroup_id IN (0, 0, 1)
AND products.parent_product_id = 0
GROUP BY products.product_id
, IF(shared_descr.product_id IS NOT NULL, shared_descr.product, descr1.product)
, products.product_type
, products.parent_product_id
, cscart_discussion.type
, cscart_discussion.thread_id
HAVING average_rating > 0
ORDER BY average_rating desc, products.product_id ASC
LIMIT 0, 10;
А
А
А
VS
VS
status
in (\'A\',\'H\'))) (cost=94.13 rows=244) (actual time=0.100..18.911 rows=1218 loops=1)status
= \'A\')) (cost=0.25 rows=0) (actual time=0.030..0.037 rows=1 loops=182728)VS
VS
А