FACET по количеству строк не может превысить количество строк в Индексе
Может. Вот пример:
mysql> drop table if exists t; create table t(a multi); insert into t values(1, (1,2,3,4,5)); select * from t facet a;
--------------
drop table if exists t
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
create table t(a multi)
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
insert into t values(1, (1,2,3,4,5))
--------------
Query OK, 1 row affected (0.00 sec)
--------------
select * from t facet a
--------------
+------+-----------+
| id | a |
+------+-----------+
| 1 | 1,2,3,4,5 |
+------+-----------+
1 row in set (0.00 sec)
--- 1 out of 1 results in 0ms ---
+------+----------+
| a | count(*) |
+------+----------+
| 5 | 1 |
| 4 | 1 |
| 3 | 1 |
| 2 | 1 |
| 1 | 1 |
+------+----------+
5 rows in set (0.00 sec)
--- 5 out of 5 results in 0ms ---
Так что непонятно, почему у вас не работает. Может просто превышен лимит фасета, как тут?
mysql> drop table if exists t; create table t(a multi); insert into t values(1, (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)); select * from t facet a;
--------------
drop table if exists t
--------------
Query OK, 0 rows affected (0.01 sec)
--------------
create table t(a multi)
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
insert into t values(1, (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23))
--------------
Query OK, 1 row affected (0.00 sec)
--------------
select * from t facet a
--------------
+------+-------------------------------------------------------------+
| id | a |
+------+-------------------------------------------------------------+
| 1 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 |
+------+-------------------------------------------------------------+
1 row in set (0.00 sec)
--- 1 out of 1 results in 0ms ---
+------+----------+
| a | count(*) |
+------+----------+
| 23 | 1 |
| 22 | 1 |
| 21 | 1 |
| 20 | 1 |
| 19 | 1 |
| 18 | 1 |
| 17 | 1 |
| 16 | 1 |
| 15 | 1 |
| 14 | 1 |
| 13 | 1 |
| 12 | 1 |
| 11 | 1 |
| 10 | 1 |
| 9 | 1 |
| 8 | 1 |
| 7 | 1 |
| 6 | 1 |
| 5 | 1 |
| 4 | 1 |
+------+----------+
20 rows in set (0.00 sec)
--- 20 out of 23 results in 0ms ---
Тогда обходится так:
select * from t facet a limit 1000
--------------
+------+-------------------------------------------------------------+
| id | a |
+------+-------------------------------------------------------------+
| 1 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 |
+------+-------------------------------------------------------------+
1 row in set (0.00 sec)
--- 1 out of 1 results in 0ms ---
+------+----------+
| a | count(*) |
+------+----------+
| 23 | 1 |
| 22 | 1 |
| 21 | 1 |
| 20 | 1 |
| 19 | 1 |
| 18 | 1 |
| 17 | 1 |
| 16 | 1 |
| 15 | 1 |
| 14 | 1 |
| 13 | 1 |
| 12 | 1 |
| 11 | 1 |
| 10 | 1 |
| 9 | 1 |
| 8 | 1 |
| 7 | 1 |
| 6 | 1 |
| 5 | 1 |
| 4 | 1 |
| 3 | 1 |
| 2 | 1 |
| 1 | 1 |
+------+----------+
23 rows in set (0.00 sec)
--- 23 out of 23 results in 0ms ---