Query time 0.00150
JSON explain
{
"query_block": {
"select_id": 1,
"cost": 0.35743628,
"filesort": {
"sort_key": "popularity.total desc, products.product_id",
"temporary_table": {
"nested_loop": [
{
"table": {
"table_name": "popularity",
"access_type": "index",
"possible_keys": ["PRIMARY", "total"],
"key": "total",
"key_length": "7",
"used_key_parts": ["product_id", "total"],
"loops": 1,
"rows": 56,
"cost": 0.01486028,
"filtered": 100,
"attached_condition": "popularity.total >= 1",
"using_index": true
}
},
{
"table": {
"table_name": "products",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY", "status", "idx_parent_product_id"],
"key": "PRIMARY",
"key_length": "3",
"used_key_parts": ["product_id"],
"ref": ["u985510652_gaurav.popularity.product_id"],
"loops": 56,
"rows": 1,
"cost": 0.05500384,
"filtered": 97.9903717,
"attached_condition": "products.parent_product_id = 0 and (products.usergroup_ids = '' or find_in_set(0,products.usergroup_ids) or find_in_set(1,products.usergroup_ids)) and products.`status` = 'A' and products.product_type <> 'D'"
}
},
{
"table": {
"table_name": "descr1",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY", "product_id"],
"key": "PRIMARY",
"key_length": "9",
"used_key_parts": ["product_id", "lang_code"],
"ref": ["u985510652_gaurav.popularity.product_id", "const"],
"loops": 54.87460978,
"rows": 1,
"cost": 0.094035326,
"filtered": 100,
"attached_condition": "trigcond(descr1.lang_code = 'en')"
}
},
{
"block-nl-join": {
"table": {
"table_name": "companies",
"access_type": "ALL",
"possible_keys": ["PRIMARY"],
"loops": 54.87460978,
"rows": 2,
"cost": 0.038072761,
"filtered": 50,
"attached_condition": "companies.`status` = 'A'"
},
"buffer_type": "flat",
"buffer_size": "88KiB",
"join_type": "BNL",
"attached_condition": "companies.company_id = products.company_id"
}
},
{
"table": {
"table_name": "prices",
"access_type": "ref",
"possible_keys": [
"usergroup",
"product_id",
"lower_limit",
"usergroup_id"
],
"key": "usergroup",
"key_length": "3",
"used_key_parts": ["product_id"],
"ref": ["u985510652_gaurav.popularity.product_id"],
"loops": 54.87460978,
"rows": 1,
"cost": 0.053749602,
"filtered": 97.63779449,
"attached_condition": "prices.lower_limit = 1 and prices.usergroup_id in (0,0,1)"
}
},
{
"table": {
"table_name": "products_categories",
"access_type": "ref",
"possible_keys": ["PRIMARY", "pt"],
"key": "pt",
"key_length": "3",
"used_key_parts": ["product_id"],
"ref": ["u985510652_gaurav.popularity.product_id"],
"loops": 53.57835916,
"rows": 1,
"cost": 0.052972643,
"filtered": 100,
"using_index": true
}
},
{
"table": {
"table_name": "cscart_categories",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY", "c_status", "p_category_id"],
"key": "PRIMARY",
"key_length": "3",
"used_key_parts": ["category_id"],
"ref": ["u985510652_gaurav.products_categories.category_id"],
"loops": 53.57835916,
"rows": 1,
"cost": 0.048741828,
"filtered": 100,
"attached_condition": "(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') and cscart_categories.storefront_id in (0,1)"
}
}
]
}
}
}
}
Result
| product_id |
product |
company_name |
popularity |
product_type |
parent_product_id |
| 280 |
T-shirt, Color: Black |
CS-Cart |
58 |
P |
0 |
| 282 |
T-shirt, Color: Blue |
CS-Cart |
56 |
P |
0 |
| 12 |
100g Pants |
CS-Cart |
49 |
P |
0 |
| 180 |
18-55mm Portrait Lens |
CS-Cart |
36 |
P |
0 |
| 1 |
65" Class (64.5" Diag.) LED 8000 Series Smart TV |
CS-Cart |
27 |
P |
0 |
| 78 |
adizero Rush Shoes |
CS-Cart |
27 |
P |
0 |
| 248 |
X-Box One |
CS-Cart |
27 |
P |
0 |
| 278 |
T-shirt, Color: White |
CS-Cart |
21 |
P |
0 |