clickhouse21.7.11.3 SQL语法优化-删除重复的order by key、limit by key

删除重复的order by key

order by age, age 中重复的 age 会被去掉

explain syntax select * from t_student_mt order by age, age

执行结果:

SELECT           
    sid,         
    name,        
    age,         
    height,      
    create_time  
FROM t_student_mt
ORDER BY age ASC

删除重复的limit by key

limit 1 by age,age 中重复的 age 会被去掉

explain syntax select * from t_student_mt2 limit 1 by age,age

执行结果:

SELECT            
    sid,          
    name,         
    age,          
    create_time   
FROM t_student_mt2
LIMIT 1 BY age

原文出处:/show_1IX3R5wqVFFP.html