improve stats generation
This commit is contained in:
parent
0c9ad5bfd6
commit
a8177a1583
5 changed files with 61 additions and 20 deletions
|
|
@ -37,7 +37,7 @@ FROM (
|
|||
) sub
|
||||
WHERE h.id = sub.host_id;
|
||||
|
||||
-- Stats
|
||||
-- Stats (human-readable)
|
||||
\echo '--- Best Icon Selection Stats ---'
|
||||
|
||||
SELECT
|
||||
|
|
@ -47,3 +47,22 @@ SELECT
|
|||
COUNT(*) FILTER (WHERE html_title IS NOT NULL AND best_icon_s3_key IS NULL) AS title_but_no_icon
|
||||
FROM hosts
|
||||
WHERE parsed = TRUE;
|
||||
|
||||
-- Stats JSON
|
||||
\! mkdir -p stats
|
||||
\t on
|
||||
\a
|
||||
\o stats/04_best_icon.json
|
||||
SELECT json_build_object(
|
||||
'hosts_with_icon', COUNT(*) FILTER (WHERE best_icon_s3_key IS NOT NULL),
|
||||
'hosts_without_icon', COUNT(*) FILTER (WHERE best_icon_s3_key IS NULL),
|
||||
'hosts_with_title', COUNT(*) FILTER (WHERE html_title IS NOT NULL),
|
||||
'hosts_no_title', COUNT(*) FILTER (WHERE html_title IS NULL),
|
||||
'title_but_no_icon', COUNT(*) FILTER (WHERE html_title IS NOT NULL AND best_icon_s3_key IS NULL)
|
||||
)
|
||||
FROM hosts
|
||||
WHERE parsed = TRUE;
|
||||
\o
|
||||
\t off
|
||||
\a
|
||||
\echo 'Stats written to stats/04_best_icon.json'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue