4 comments (4 comments)0 reactions (0 reactions)0 assignees (0 assignees)C24,849 stars (24,849 stars)5,002 forks (5,002 forks)batch import
help wantedquestion
Description
使用这样的sql语句查询对主键排序特别慢,这是为什么呢,有什么解决办法吗 select * from alarm_log order by ts desc limit 0,10;
Contributor guide
- Tech stack
- csql
- Domain
- databaseperformance
- Issue type
- performance
- DifficultyEstimated implementation difficulty for a new contributor, from 1 for very small changes to 5 for expert-level work.
- 3
- Estimated timeA rough time range for an experienced contributor to investigate, implement, test, and prepare a pull request.
- 1-3 hours
- Activity statusHow available the issue appears right now: fresh, active, stale, blocked, or waiting on maintainer input.
- fresh
- ClarityHow clearly the issue explains the expected change, acceptance criteria, and next step.
- needs investigation
- Prerequisites
- Basic understanding of TDengineSQL query optimization concepts
- Newbie friendlinessA 1-100 score estimating how approachable this issue is for first-time contributors.
- 20
- Research direction
- The issue lacks schema details (e.g., number of columns, data volume), query execution plan, and whether the super table's primary key is properly indexed. First, check if the user has provided a reproducible test case in the comments. Look at the query execution path in TSDB: examine the order by implementation in the source code (likely in `tsdb/` directory). Verify if the query uses the primary key index or performs a full scan. Search for similar reported issues in the repository. If possible, replicate the slow query with a simple schema and measure performance with and without order by. Provide guidance on using EXPLAIN to get query plan.