load_date UInt64
                  
                  
                          , id UInt32
                  
                  
                          , type_id UInt16
                  
                  
                          /*прочие поля*/
                  
                  
                          , sn String
                  
                  
                          , deleted UInt8
                  
                  
                        )
                  
                  
                        ENGINE = MergeTree()
                  
                  
                        PARTITION BY (sn, id)
                  
                  
                        ORDER BY (sn, id, type_id, load_date)
                  
                  
                        SETTINGS index_granularity = 8192
                  
                  
                  
                  
                  
                  запросы всегда идут с where sn = ?, id = ?
                  
                  
                
А можно глянуть на select * from system.parts where table ='tbl' and active order by rows desc limit 10?
>PARTITION BY toYYYYMM(load_date) > ORDER BY (sn, id, type_id, load_date) >запросы всегда идут с where sn = ?, id = ? ORDER BY покрывает вашу задачу
Обсуждают сегодня