internal/host: sort public_id descending

The previous sort would run the risk of missing items which
collide on update or create times because of the compound
comparison using strictly less than for both the timestamp
and the public_id. Sorting both descending avoids this issue.
This commit is contained in:
Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:21 -08:00
1 parent a8c360ebf4
commit b3207d8e1c
3 files changed
+14 -14

No files matched your search

@@ -5,17 +5,17 @@ begin;
-- Add new indexes for the create time and update time queries.
create index host_plugin_set_create_time_public_id_idx
on host_plugin_set (create_time desc, public_id asc);
on host_plugin_set (create_time desc, public_id desc);
create index host_plugin_set_update_time_public_id_idx
on host_plugin_set (update_time desc, public_id asc);
on host_plugin_set (update_time desc, public_id desc);
analyze host_plugin_set;
-- Add new indexes for the create time and update time queries.
create index static_host_set_create_time_public_id_idx
on static_host_set (create_time desc, public_id asc);
on static_host_set (create_time desc, public_id desc);
create index static_host_set_update_time_public_id_idx
on static_host_set (update_time desc, public_id asc);
on static_host_set (update_time desc, public_id desc);
analyze static_host_set;