Skip to content

Instantly share code, notes, and snippets.

@amacal
Created November 25, 2020 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amacal/6aaf5736e67f15b51d08e7a822ea12f7 to your computer and use it in GitHub Desktop.
Save amacal/6aaf5736e67f15b51d08e7a822ea12f7 to your computer and use it in GitHub Desktop.
with source as
(
select * from ecds_db.playground.time11M
),
timeline as
(
select start_at as moment
from source
union
select end_at as moment
from source
),
concurrency as
(
select t.moment, count(s.id) as count
from timeline t
join source s on t.moment between s.start_at and s.end_at
group by t.moment
)
select max(count)
from concurrency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment