我有一个具有以下结构的表:
id bigNumber text
1 1200321030011010233 "an item with some text"
2 1200321030011014563 "another item with some more text"
3 3120323434432211133 "more...."
.
.
.
该表包含大约 50,000 条记录。我想做以下查询,但速度很慢:
SELECT COUNT(*),
bigNumber
FROM items
GROUP BY substr(bigNumber, 1, X)
其中 X 从 2 到 19 不等。
创建 19 列并在每列中包含部分数字以便能够使用索引会更快吗?