Skip to content

Instantly share code, notes, and snippets.

@jaymay
Created May 6, 2015 22:32
Show Gist options
  • Save jaymay/c1faf404157022efd1a1 to your computer and use it in GitHub Desktop.
Save jaymay/c1faf404157022efd1a1 to your computer and use it in GitHub Desktop.
Voice duration and wait time benchmarks
select results.industry,
percentile_approx(avg_duration/60, 0.5) avg_duration_minutes,
percentile_approx(avg_wait_time/60, 0.5) avg_wait_time_minutes,
count(*) num_accounts,
sum(count) num_calls
from
(
select
asr.industry,
v.account_id,
avg(v.duration) avg_duration,
avg(v.wait_time) avg_wait_time,
avg(v.wrap_up_time) avg_wrap_up_time,
count(*) count
from voice.voice_composite_call_details v
inner join voice.voice_composite_calls c on v.composite_call_id = c.id
inner join classic.sharded_subscriptions ss on ss.account_id = v.account_id
inner join classic.account_survey_responses asr on asr.account_id = v.account_id
where ss.account_type = 'customer'
and v.voicemail = 0
and v.duration > 0
group by asr.industry, v.account_id
) results
where count > 100
group by results.industry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment