Guest User

Untitled

a guest
Jun 22nd, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. mysql> SELECT count(DISTINCT `posts`.id) AS count_all FROM `posts` LEFT OUTER JOIN `categories` ON `categorie_id`;
  2. +-----------+
  3. | count_all |
  4. +-----------+
  5. | 45618 |
  6. +-----------+
  7. 1 row in set (4.12 sec)
  8.  
  9. mysql> explain SELECT count(DISTINCT `posts`.id) AS count_all FROM `posts` LEFT OUTER JOIN `categories` ON `categorie_id`;
  10. +----+-------------+------------+-------+---------------+------------------------------+---------+------+-------+-------------+
  11. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  12. +----+-------------+------------+-------+---------------+------------------------------+---------+------+-------+-------------+
  13. | 1 | SIMPLE | posts | index | NULL | index_posts_on_categorie_id | 5 | NULL | 45861 | Using index |
  14. | 1 | SIMPLE | categories | index | NULL | PRIMARY | 4 | NULL | 199 | Using index |
  15. +----+-------------+------------+-------+---------------+------------------------------+---------+------+-------+-------------+
Add Comment
Please, Sign In to add comment