useful analytics queries

This commit is contained in:
Brandon Thomas committed 2024-08-31 19:16:04 -04:00
1 parent 83d5ae9e13
commit 736f4a24b1
5 files changed
+99 -12

No files matched your search

@@ -153,6 +153,14 @@ AND created_at <= '2024-08-30'
LIMIT 100000;
-- Update GptSoVits Download Jobs
UPDATE generic_inference_jobs
SET product_category = 'download_gpt_so_vits'
WHERE job_type = 'gpt_sovits'
AND maybe_download_url IS NOT NULL
LIMIT 10000;
--- TODO: Not working
--- Update RVCv2 VC jobs
UPDATE generic_inference_jobs
@@ -0,0 +1,17 @@
-- Doc: https://docs.google.com/document/d/14AyEV_0PYwa71a5W8xRRZ8vbI0uZHQF4ycqi539qmAc/edit
-- bluemo69: SpongeBob (abandoned)
-- dzth: likely AI streamer - 144,653 media files (all audio, mostly SpongeBob, using old tokens) in August 2024
-- johnloberger: AI South Park
-- rewritten_code: AI Breaking Bad
UPDATE users
SET is_api_user = TRUE
WHERE username IN (
'bluemo69',
'dzth',
'johnloberger',
'rewritten_code'
);
-- TODO:
-- leon_says: ???? - 209,745 media files in August 2024
-- robertmctague: ???? - 285,664 media files in August 2024
@@ -0,0 +1,10 @@
SELECT
m.media_type,
COUNT(*)
FROM media_files as m
JOIN users as u
ON m.maybe_creator_user_token = u.token
WHERE u.username = lower('dzth')
GROUP BY m.media_type
@@ -0,0 +1,47 @@
-- Select most used tts models by user
-- This query has old token support!
SELECT
mw.token,
mw.title,
count(*) as use_count
FROM model_weights as mw
JOIN (
select
coalesce(w.token, w_migrated.token) as token
from media_files as f
left outer join model_weights as w
on f.maybe_origin_model_token = w.token
left outer join model_weights as w_migrated
on f.maybe_origin_model_token = w_migrated.maybe_migration_old_model_token
join users as u
on f.maybe_creator_user_token = u.token
where u.username = lower('dzth')
) as x
on mw.token = x.token
group by mw.token, mw.title
order by use_count desc
-- See a sample of tts results by user
-- This includes old token support
select
f.token,
f.origin_product_category,
f.created_at,
w.token,
w.title,
w_migrated.token,
w_migrated.title,
SUBSTRING(TRIM(f.maybe_text_transcript), 1, 100) as transcript
from media_files as f
left outer join model_weights as w
on f.maybe_origin_model_token = w.token
left outer join model_weights as w_migrated
on f.maybe_origin_model_token = w_migrated.maybe_migration_old_model_token
join users as u
on f.maybe_creator_user_token = u.token
where u.username = lower('dzth')
order by f.id desc
limit 100
@@ -2,6 +2,23 @@
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
SELECT
m.maybe_creator_user_token as user_token,
u.username,
count(*) as usage_count,
u.created_at
FROM media_files as m
JOIN users as u
ON u.token = m.maybe_creator_user_token
WHERE m.maybe_creator_user_token IS NOT NULL
AND m.created_at > NOW() - INTERVAL 31 DAY
GROUP BY m.maybe_creator_user_token
ORDER BY usage_count DESC
LIMIT 50000;
----- Older queries -----
SELECT
u.username as username,
j.token as token
@@ -11,18 +28,6 @@ ON u.token = j.maybe_creator_user_token
AND j.created_at > NOW() - INTERVAL 31 DAY
SELECT
t.maybe_creator_user_token as user_token,
u.username,
count(*) as usage_count,
u.created_at
FROM tts_results as t
JOIN users as u
ON u.token = t.maybe_creator_user_token
WHERE t.maybe_creator_user_token IS NOT NULL
GROUP BY t.maybe_creator_user_token
ORDER BY usage_count DESC
LIMIT 50000;
SELECT