4 commentaires (4 commentaires)0 réactions (0 réactions)0 assignés (0 assignés)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;
Guide contributeur
- Stack technique
- csql
- Domaine
- databaseperformance
- Type d'issue
- performance
- DifficultéDifficulté estimée pour un nouveau contributeur, de 1 pour un très petit changement à 5 pour un travail expert.
- 3
- Temps estiméFourchette de temps approximative pour investiguer, implémenter, tester et préparer une pull request.
- 1-3 hours
- Statut d'activitéDisponibilité apparente de l'issue : fraîche, active, ancienne, bloquée ou en attente d'un mainteneur.
- fresh
- ClartéClarté avec laquelle l'issue explique le changement attendu, les critères d'acceptation et la prochaine étape.
- needs investigation
- Prérequis
- Basic understanding of TDengineSQL query optimization concepts
- Accessibilité débutantScore de 1 à 100 estimant l'accessibilité de cette issue pour un premier contributeur.
- 20
- Direction de recherche
- 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.