SQL:
1
2
3
4
5
6
7
8
9
10
| SELECT shop_items.title AS title, shop_items.price AS price, shop_stock.stock AS stock FROM shop_items LEFT JOIN shop_stock ON (shop_items.num=shop_stock.id) ORDER BY shop_items.title ASC |
Ik wil graag deze query uitvoeren, de tabellen shop_items en shop_stock zijn allebei ongeveer 24.000 rijen. Nu is het probleem dat deze query echt minutenlang bezig is, ik heb begrepen dat het iets met indexen is, en ik heb shop_items.num en shop_stock.id primary key gemaakt, maar het duurt nog steeds zo lang.
dit is wat ik met explain krijg
code:
1
2
3
| id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE shop_items ALL NULL NULL NULL NULL 24640 Using temporary; Using filesort 1 SIMPLE shop_stock ALL NULL NULL NULL NULL 23678 |
Iemand die het weet?