more iops cheese testing - sort by downloaded_at not host id
This commit is contained in:
parent
a30fe104a3
commit
9266c1417d
3 changed files with 62 additions and 22 deletions
|
|
@ -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
|
||||
SELECT DISTINCT ON (host_id) host_id, icon_hash, downloaded_at
|
||||
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
|
||||
UPDATE hosts h SET best_icon_hash = b.icon_hash, icon_downloaded_at = b.downloaded_at
|
||||
FROM best_icons b WHERE h.id = b.host_id;
|
||||
|
||||
\timing off
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue