ExpandedVenture / ConnectionSphere

Simple Service to Start Prospecting Online
0 stars 0 forks source link

Get all accounts delivering XX connection requests / day #206

Open ExpandedVenture opened 2 years ago

ExpandedVenture commented 2 years ago
use euler;

select 
    u.username, 
    count(distinct y.id) as activities,
    count(distinct s.id_result) as invites
from pipeline_lnuser x with (nolock)
join lnuser u with (nolock) on u.id=x.id_lnuser
left join lnuseractivity y with (nolock) on ( 
    u.id=y.id_lnuser and 
    isnull(y.code,0)=1 and
    y.create_time>dateadd(dd,-1,getdate()) 
)
left join drl_minutely_stats s with (nolock) on (
    u.id=s.id_lnuser and
--  s.id_client=(select id from client where [name]='Better *** LLC') and
    isnull(s.ininvite_end_time, '1900-01-01') > dateadd(dd,-1,getdate())
)
where x.id_pipeline='1BAF19ED-A47A-4081-B090-31EE217DBB34'
and u.edit_profile_end_time is NOT null
group by u.username
order by count(distinct y.id) desc

Output:

brittany.manfredi@***.***   55  7
jack.sacramento@***.*** 47  9
karla.hayes@***.*** 44  2
sarah.binder@***.***    42  10
lindsey.greenholt@***.***   40  11
darlene.guevara@***.*** 40  3
audrey.healy@***.***    38  10
ExpandedVenture commented 2 years ago

It is possible to extend the max-logins-per-day ?

select 
    u.username, 
    u.drx_max_logins_per_day,
    count(distinct y.id) as activities,
    count(distinct s.id_result) as invites
from pipeline_lnuser x with (nolock)
join lnuser u with (nolock) on u.id=x.id_lnuser
left join lnuseractivity y with (nolock) on ( 
    u.id=y.id_lnuser and 
    isnull(y.code,0)=1 and
    y.create_time>dateadd(dd,-1,getdate()) 
)
left join drl_minutely_stats s with (nolock) on (
    u.id=s.id_lnuser and
--  s.id_client=(select id from client where [name]='Better Online Info LLC') and
    isnull(s.ininvite_end_time, '1900-01-01') > dateadd(dd,-1,getdate())
)
where x.id_pipeline='1BAF19ED-A47A-4081-B090-31EE217DBB34'
and u.edit_profile_end_time is NOT null
group by u.username, u.drx_max_logins_per_day
order by count(distinct y.id) desc
ExpandedVenture commented 2 years ago

Each GAUSS server can deliver 2,500 connection requests per day.

Use the query to know how many connecton requests per day you need to deliver, based on the number of active accounts.

select 
    count(distinct u.id) as total_accounts, 
    count(distinct x.id_lnuser) as working_accounts,
    count(distinct x.id_lnuser)*10 as connection_requests_per_day
from lnuser u with (nolock)
left join pipeline_lnuser x with (nolock) on u.id=x.id_lnuser
where u.delete_time is null
ExpandedVenture commented 2 years ago

Query to see the queue of messages for each account

select c.name, p.name, u.username, count(distinct s.id_result) as invites, count(distinct h.id) as invites_in_queue
from lnuser u with (nolock)
left join drl_minutely_stats s with (nolock) on ( 
    u.id=s.id_lnuser and
    isnull(s.ininvite_end_time,'1900-01-01') > dateadd(hh,-24,getdate())
)
join pipeline_lnuser x with (nolock) on u.id=x.id_lnuser
join pipeline p with (nolock) on p.id=x.id_pipeline
join [user] e with (nolock) on e.id=p.id_user
join client c with (nolock) on c.id=e.id_client
left join [message] m with (nolock) on (
    p.id=m.id_pipeline and
    isnull(m.status,0) = 1 and
    isnull(m.trigger_type,0) = 0
)
left join lnchat h with (nolock) on (
    m.id=h.id_message and
    h.direction=0 and
    h.create_time > dateadd(hh,-24,getdate()) and
    h.inmessage_end_time is null and
    isnull(h.inmessage_tries,0) < 3
)
where u.delete_time is null
group by c.name, p.name, u.username
order by c.name, p.name, u.username