Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql> SELECT count(DISTINCT `posts`.id) AS count_all FROM `posts` LEFT OUTER JOIN `categories` ON `categorie_id`;
- +-----------+
- | count_all |
- +-----------+
- | 45618 |
- +-----------+
- 1 row in set (4.12 sec)
- mysql> explain SELECT count(DISTINCT `posts`.id) AS count_all FROM `posts` LEFT OUTER JOIN `categories` ON `categorie_id`;
- +----+-------------+------------+-------+---------------+------------------------------+---------+------+-------+-------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+------------+-------+---------------+------------------------------+---------+------+-------+-------------+
- | 1 | SIMPLE | posts | index | NULL | index_posts_on_categorie_id | 5 | NULL | 45861 | Using index |
- | 1 | SIMPLE | categories | index | NULL | PRIMARY | 4 | NULL | 199 | Using index |
- +----+-------------+------------+-------+---------------+------------------------------+---------+------+-------+-------------+
Add Comment
Please, Sign In to add comment