Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1954

count distinct for more than 500,000 rows? (1 reply)

$
0
0
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    |
+-----------+

Viewing all articles
Browse latest Browse all 1954

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>