mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 17:08:13 +00:00
Index on tts results creation date, query on popular models by date
This commit is contained in:
1 parent
b71278aef1
commit
d4afc42d5c
3 files changed
+22
No files matched your search
@@ -0,0 +1,5 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
DROP INDEX `index_created_at` ON `tts_results`;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
CREATE INDEX `index_created_at` ON `tts_results` (`created_at`);
|
||||
@@ -0,0 +1,12 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
select m.token, m.title, r.use_count from (
|
||||
select model_token, count(*) as use_count from tts_results
|
||||
where created_at < now() - interval 30 day
|
||||
group by model_token
|
||||
order by use_count desc limit 100
|
||||
) as r
|
||||
join tts_models as m
|
||||
on m.token = r.model_token;
|
||||
Reference in new issue
Block a user