select cid,max(max_peak_uv) as max_peak_uv
from 
(select
    t1.cid,

        sum(t1.tag) over (
            partition by
                cid
            order by
                dt asc,
                tag desc
        )
     as max_peak_uv
from
    (
        select
            cid,
            start_time as dt,
            1 as tag
        from
            play_record_tb
        union all
        select
            cid,
            end_time as dt,
            -1 as tag
        from
            play_record_tb
    ) as t1) as t2
    group by cid
    order by max_peak_uv desc
    limit 3;