more analytics, etc. queries

This commit is contained in:
Brandon Thomas committed 2023-07-24 19:22:47 -04:00
1 parent 986e8b104a
commit 062a80fafa
4 files changed
+54 -2

No files matched your search

+43 -1
View File
@@ -37,7 +37,7 @@ FROM (
x.use_count > 10;
-- The first voice a paying customer uses
-- The first TTS voice a paying customer uses
-- TODO: List *all* of the voices a paying customer uses before they subscribe, not just the first.
-- select first row of partially aggregate query: https://stackoverflow.com/a/73157541
SELECT *
@@ -78,6 +78,48 @@ FROM (
) AS z
ORDER BY use_count desc
-- The first VC voice a paying customer uses
-- TODO: List *all* of the voices a paying customer uses before they subscribe, not just the first.
-- select first row of partially aggregate query: https://stackoverflow.com/a/73157541
SELECT *
FROM (
SELECT
m.token,
m.title,
count(*) as use_count,
m.created_at,
m.user_deleted_at,
m.mod_deleted_at
FROM voice_conversion_models AS m
JOIN
(
SELECT
model_token
FROM (
SELECT
maybe_model_token as model_token,
maybe_creator_user_token,
row_number() over(partition by maybe_creator_user_token order by id asc) as rownum
FROM
generic_inference_jobs
WHERE maybe_model_token IS NOT NULL
AND maybe_creator_user_token IN
(
select distinct user_token
from user_subscriptions
where created_at > (CURDATE() - INTERVAL 2 DAY)
)
) AS x
WHERE rownum = 1
ORDER BY model_token desc
) AS y
ON m.token = y.model_token
GROUP BY m.token
) AS z
ORDER BY use_count desc
-- The last voice a paying customer uses
-- select first row of partially aggregate query: https://stackoverflow.com/a/73157541
SELECT *
@@ -35,7 +35,9 @@ left join users AS u on
where
vc.user_deleted_at IS NULL
and vc.mod_deleted_at IS NULL
order by vc.original_download_url ASC;
order by vc.title asc;
-- order by vc.original_download_url ASC;
--
-- Top 100 voice conversion models by use count
@@ -0,0 +1,8 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- NB: These are for use in Stripe Sigma, not MySQL
-- NB: You must use single quotes instead of double quotes when comparing string values.