Created
November 2, 2022 18:57
-
-
Save dlebauer/c840ab669383f8d1a4d1d7436176a90e to your computer and use it in GitHub Desktop.
figuring out why the dbfiles table gets so big
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select extract(year from created_at) as year, container_type, count(*) as n from dbfiles where id between 1000000000 and 2000000000 group by container_type, year order by container_type, year; | |
select created_user_id, container_type, count(*) as n from dbfiles where id between 1000000000 and 2000000000 group by container_type, created_user_id order by n desc; | |
select * from dbfiles where created_user_id is not null; | |
select extract(year from created_at) as year, created_user_id, container_type, count(*) as n from dbfiles where id between 9000000000 and 10000000000 group by container_type, created_user_id, year order by year, container_type, created_user_id; | |
select null as year, created_user_id, container_type, count(*) as n from dbfiles where id between 9000000000 and 10000000000 group by container_type, created_user_id order by container_type, created_user_id; | |
select count(*) from dbfiles where container_type = 'Posterior'; | |
select count(distinct container_id) from dbfiles where container_type = 'Posterior'; | |
select count(*) as n, container_id from dbfiles where container_type = 'Posterior' group by container_id order by n desc; | |
select * from dbfiles where container_id = 1000000032; | |
select count(*) from dbfiles where container_type = 'Input'; --462,801 | |
select count(distinct container_id) from dbfiles where container_type = 'Input'; --374,782 | |
select count(distinct file_name) from dbfiles where container_type = 'Input';--400,000 | |
select count(distinct file_path) from dbfiles where container_type = 'Input';--208,961 | |
select count(*) as n, file_path from dbfiles where container_type = 'Posterior' group by file_path order by n desc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment