diff --git a/internal/db/schema/migrations/oss/postgres/80/09_host_table_updates.up.sql b/internal/db/schema/migrations/oss/postgres/80/09_host_table_updates.up.sql index cccf646a16..f5eef1a047 100644 --- a/internal/db/schema/migrations/oss/postgres/80/09_host_table_updates.up.sql +++ b/internal/db/schema/migrations/oss/postgres/80/09_host_table_updates.up.sql @@ -5,17 +5,17 @@ begin; -- Add new indexes for the create time and update time queries. create index host_plugin_host_create_time_public_id_idx - on host_plugin_host (create_time desc, public_id asc); + on host_plugin_host (create_time desc, public_id desc); create index host_plugin_host_update_time_public_id_idx - on host_plugin_host (update_time desc, public_id asc); + on host_plugin_host (update_time desc, public_id desc); analyze host_plugin_host; -- Add new indexes for the create time and update time queries. create index static_host_create_time_public_id_idx - on static_host (create_time desc, public_id asc); + on static_host (create_time desc, public_id desc); create index static_host_update_time_public_id_idx - on static_host (update_time desc, public_id asc); + on static_host (update_time desc, public_id desc); analyze static_host; diff --git a/internal/host/plugin/query.go b/internal/host/plugin/query.go index afbf86abb0..c1a27b4bff 100644 --- a/internal/host/plugin/query.go +++ b/internal/host/plugin/query.go @@ -72,7 +72,7 @@ with hosts as ( version from host_plugin_host where catalog_id = @catalog_id - order by create_time desc, public_id asc + order by create_time desc, public_id desc limit %d ), host_catalog as ( @@ -126,7 +126,7 @@ final as ( ) select * from final -order by create_time desc, public_id asc; +order by create_time desc, public_id desc; ` listHostsPageTemplate = ` @@ -143,7 +143,7 @@ with hosts as ( from host_plugin_host where catalog_id = @catalog_id and (create_time, public_id) < (@last_item_create_time, @last_item_id) - order by create_time desc, public_id asc + order by create_time desc, public_id desc limit %d ), host_catalog as ( @@ -197,7 +197,7 @@ final as ( ) select * from final -order by create_time desc, public_id asc; +order by create_time desc, public_id desc; ` listHostsRefreshTemplate = ` @@ -214,7 +214,7 @@ with hosts as ( from host_plugin_host where catalog_id = @catalog_id and update_time > @updated_after_time - order by update_time desc, public_id asc + order by update_time desc, public_id desc limit %d ), host_catalog as ( @@ -268,7 +268,7 @@ final as ( ) select * from final -order by update_time desc, public_id asc; +order by update_time desc, public_id desc; ` listHostsRefreshPageTemplate = ` @@ -286,7 +286,7 @@ with hosts as ( where catalog_id = @catalog_id and update_time > @updated_after_time and (update_time, public_id) < (@last_item_update_time, @last_item_id) - order by update_time desc, public_id asc + order by update_time desc, public_id desc limit %d ), host_catalog as ( @@ -340,7 +340,7 @@ final as ( ) select * from final -order by update_time desc, public_id asc; +order by update_time desc, public_id desc; ` estimateCountHostSets = ` diff --git a/internal/host/static/query.go b/internal/host/static/query.go index a3b8bad449..b64a0ef56b 100644 --- a/internal/host/static/query.go +++ b/internal/host/static/query.go @@ -63,7 +63,7 @@ with hosts as ( version from static_host where catalog_id = @catalog_id - order by create_time desc, public_id asc + order by create_time desc, public_id desc limit %d ), host_set_ids as ( @@ -88,7 +88,7 @@ final as ( ) select * from final -order by create_time desc, public_id asc; +order by create_time desc, public_id desc; ` listHostsPageTemplate = ` @@ -104,7 +104,7 @@ with hosts as ( from static_host where catalog_id = @catalog_id and (create_time, public_id) < (@last_item_create_time, @last_item_id) - order by create_time desc, public_id asc + order by create_time desc, public_id desc limit %d ), host_set_ids as ( @@ -129,7 +129,7 @@ final as ( ) select * from final -order by create_time desc, public_id asc; +order by create_time desc, public_id desc; ` listHostsRefreshTemplate = ` @@ -145,7 +145,7 @@ with hosts as ( from static_host where catalog_id = @catalog_id and update_time > @updated_after_time - order by update_time desc, public_id asc + order by update_time desc, public_id desc limit %d ), host_set_ids as ( @@ -170,7 +170,7 @@ final as ( ) select * from final -order by update_time desc, public_id asc; +order by update_time desc, public_id desc; ` listHostsRefreshPageTemplate = ` with hosts as ( @@ -186,7 +186,7 @@ with hosts as ( where catalog_id = @catalog_id and update_time > @updated_after_time and (update_time, public_id) < (@last_item_update_time, @last_item_id) - order by update_time desc, public_id asc + order by update_time desc, public_id desc limit %d ), host_set_ids as ( @@ -211,7 +211,7 @@ final as ( ) select * from final -order by update_time desc, public_id asc; +order by update_time desc, public_id desc; ` estimateCountHostSets = `