revert to using host id ordering for bundle generation

This commit is contained in:
Joe Lothan 2026-05-26 01:33:14 -04:00
parent 9266c1417d
commit 1343df1a41
3 changed files with 20 additions and 62 deletions

View file

@ -21,7 +21,7 @@ SET work_mem = '2GB';
\timing on
CREATE TEMP TABLE best_icons AS
SELECT DISTINCT ON (host_id) host_id, icon_hash, downloaded_at
SELECT DISTINCT ON (host_id) host_id, icon_hash
FROM icons
WHERE scan_state = 'completed'
AND icon_hash IS NOT NULL
@ -50,7 +50,7 @@ ORDER BY host_id,
\echo 'Step 2: Updating hosts...'
UPDATE hosts h SET best_icon_hash = b.icon_hash, icon_downloaded_at = b.downloaded_at
UPDATE hosts h SET best_icon_hash = b.icon_hash
FROM best_icons b WHERE h.id = b.host_id;
\timing off