ClickHouse/tests/performance/window_functions.xml

39 lines
1.0 KiB
XML
Raw Normal View History

<test>
<preconditions>
<table_exists>hits_100m_single</table_exists>
</preconditions>
2020-12-25 03:15:36 +00:00
<settings>
<allow_experimental_window_functions>1</allow_experimental_window_functions>
</settings>
<!--
For some counters, find top 10 users by the numer of records.
First with LIMIT BY, next with window functions.
-->
<query><![CDATA[
2020-12-28 10:08:38 +00:00
select CounterID, UserID, count(*) user_hits
from hits_100m_single
where CounterID < 10000
group by CounterID, UserID
2020-12-28 10:08:38 +00:00
order by user_hits desc
limit 10 by CounterID
format Null
]]></query>
<query><![CDATA[
select *
from (
2020-12-28 10:08:38 +00:00
select CounterID, UserID, count(*) user_hits,
count() over (partition by CounterID order by user_hits desc)
user_rank
from hits_100m_single
where CounterID < 10000
group by CounterID, UserID
)
2020-12-28 10:08:38 +00:00
where user_rank <= 10
format Null
]]></query>
</test>