Calculate netspeed points, too
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
31
query.sql
31
query.sql
@@ -5,3 +5,34 @@ FROM zone_server_counts zc USE INDEX (date_idx)
|
||||
ON(zc.zone_id=z.id)
|
||||
WHERE date IN (SELECT max(date) from zone_server_counts)
|
||||
ORDER BY name;
|
||||
|
||||
|
||||
-- name: GetServerNetspeed :one
|
||||
select netspeed from servers where ip = ?;
|
||||
|
||||
-- name: GetZoneStatsV2 :many
|
||||
select zone_name, netspeed_active+0 as netspeed_active FROM (
|
||||
SELECT
|
||||
z.name as zone_name,
|
||||
SUM(
|
||||
IF (deletion_on IS NULL AND score_raw > 10,
|
||||
netspeed,
|
||||
0
|
||||
)
|
||||
) AS netspeed_active
|
||||
FROM
|
||||
servers s
|
||||
INNER JOIN server_zones sz ON (sz.server_id = s.id)
|
||||
INNER JOIN zones z ON (z.id = sz.zone_id)
|
||||
INNER JOIN (
|
||||
select zone_id, s.ip_version
|
||||
from server_zones sz
|
||||
inner join servers s on (s.id=sz.server_id)
|
||||
where s.ip=?
|
||||
) as srvz on (srvz.zone_id=z.id AND srvz.ip_version=s.ip_version)
|
||||
WHERE
|
||||
(deletion_on IS NULL OR deletion_on > NOW())
|
||||
AND in_pool = 1
|
||||
AND netspeed > 0
|
||||
GROUP BY z.name)
|
||||
AS server_netspeed
|
||||
Reference in New Issue
Block a user