Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

develop: fix paging sql with multiple columns for cluster index table #11341

Merged
merged 3 commits into from
Jan 18, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions develop/dev-guide-paginate-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ GROUP BY page_num
ORDER BY page_num;
```

> **Note:**
Mini256 marked this conversation as resolved.
Show resolved Hide resolved
>
> 该 SQL 会以 `TableFullScan` 方式执行,当数据量较大时,查询速度会变慢,这里可以[使用 TiFlash](/tiflash/tiflash-overview.md#使用-tiflash)进行加速。
Mini256 marked this conversation as resolved.
Show resolved Hide resolved

查询结果如下:

```
Expand All @@ -331,7 +335,12 @@ ORDER BY page_num;
```sql
SELECT * FROM ratings
WHERE
(book_id, user_id) >= (268996, 92104804)
AND (book_id, user_id) <= (140982742, 374645100)
(book_id > 268996 AND book_id < 140982742)
OR (
book_id = 268996 AND user_id >= 92104804
)
OR (
book_id = 140982742 AND user_id <= 374645100
)
ORDER BY book_id, user_id;
```