MySQL Forums
Forum List  »  InnoDB

count distinct for more than 500,000 rows?
Posted by: Joris Van den Bogaert
Date: October 16, 2013 02:59PM

I have a strange situation. An InnoDB table with a couple million rows. A distinct on one of the columns was always yielding 0. With some binary search I found that it is the case then the id is smaller than 500,000 ? What's that all about?

mysql> select count(distinct theme_author) from url_item where id < 499999;
+------------------------------+
| count(distinct theme_author) |
+------------------------------+
|                        36493 |
+------------------------------+
1 row in set (0.44 sec)

mysql> select count(distinct theme_author) from url_item where id < 500000;
+------------------------------+
| count(distinct theme_author) |
+------------------------------+
|                            0 |
+------------------------------+
1 row in set (0.44 sec)



mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.12    |
+-----------+

Options: ReplyQuote


Subject
Views
Written By
Posted
count distinct for more than 500,000 rows?
1495
October 16, 2013 02:59PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.