mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-09 03:21:23 +00:00
queries
This commit is contained in:
1 parent
844554f2e7
commit
b6279776af
3 files changed
+21
-8
No files matched your search
@@ -12,7 +12,7 @@ SELECT
|
||||
maybe_creator_user_token,
|
||||
users.username as maybe_creator_username,
|
||||
creator_ip_address,
|
||||
count(*) as attempts
|
||||
count(*) as total_job_count
|
||||
FROM (
|
||||
SELECT
|
||||
maybe_creator_user_token,
|
||||
@@ -22,15 +22,16 @@ FROM (
|
||||
creator_ip_address,
|
||||
created_at
|
||||
FROM generic_inference_jobs
|
||||
where status = 'pending'
|
||||
ORDER BY id DESC
|
||||
LIMIT 10000
|
||||
LIMIT 50000
|
||||
) as j
|
||||
WHERE j.created_at > NOW() - INTERVAL 30 MINUTE
|
||||
) as jobs
|
||||
LEFT OUTER JOIN users
|
||||
ON users.token = jobs.maybe_creator_user_token
|
||||
group by maybe_creator_user_token, maybe_creator_username, creator_ip_address
|
||||
order by attempts desc;
|
||||
order by total_job_count desc;
|
||||
|
||||
|
||||
-- Bin histogram by creator user (including logged out)
|
||||
@@ -38,7 +39,7 @@ order by attempts desc;
|
||||
SELECT
|
||||
users.username as maybe_creator_username,
|
||||
maybe_creator_user_token,
|
||||
count(*) as attempts
|
||||
count(*) as total_job_count
|
||||
FROM (
|
||||
SELECT
|
||||
maybe_creator_user_token,
|
||||
@@ -56,7 +57,7 @@ FROM (
|
||||
LEFT OUTER JOIN users
|
||||
ON users.token = jobs.maybe_creator_user_token
|
||||
group by maybe_creator_user_token, maybe_creator_username
|
||||
order by attempts desc;
|
||||
order by total_job_count desc;
|
||||
|
||||
|
||||
-- Bin histogram by IP (logged in and non-logged in)
|
||||
|
||||
@@ -2,7 +2,19 @@
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Histogram by type
|
||||
-- Pending jobs
|
||||
select
|
||||
count(*),
|
||||
job_type
|
||||
from generic_inference_jobs
|
||||
where status in ('pending', 'started', 'attempt_failed')
|
||||
group by job_type;
|
||||
|
||||
update generic_inference_jobs
|
||||
set status = 'dead'
|
||||
where status in ('pending', 'started', 'attempt_failed')
|
||||
|
||||
-- Histogram by type over last 50,000 jobs
|
||||
-- NB: no index on ip, hence subquery
|
||||
select
|
||||
job_type,
|
||||
@@ -20,7 +32,7 @@ FROM (
|
||||
) as j
|
||||
group by job_type, inference_category, maybe_model_type;
|
||||
|
||||
-- Histogram by type (still processing)
|
||||
-- Histogram by type over last 50,000 jobs that are "still processing"
|
||||
-- NB: no index on ip, hence subquery
|
||||
select
|
||||
job_type,
|
||||
|
||||
@@ -35,7 +35,7 @@ from (
|
||||
select maybe_model_token, count(*) as use_count
|
||||
from generic_inference_jobs
|
||||
where maybe_model_token IS NOT NULL
|
||||
and created_at > NOW() - INTERVAL 1 DAY
|
||||
and created_at > NOW() - INTERVAL 7 DAY
|
||||
and id > 40000000
|
||||
group by maybe_model_token
|
||||
) as r
|
||||
|
||||
Reference in new issue
Block a user