Merge remote-tracking branch 'origin/main' into fix_community_outbox

This commit is contained in:
Dessalines 2024-04-27 11:01:02 -04:00
commit 95ed87e87e
6 changed files with 326 additions and 78 deletions

26
Cargo.lock generated
View File

@ -2582,7 +2582,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "lemmy_api" name = "lemmy_api"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2611,7 +2611,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_api_common" name = "lemmy_api_common"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2649,7 +2649,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_api_crud" name = "lemmy_api_crud"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"accept-language", "accept-language",
"activitypub_federation", "activitypub_federation",
@ -2672,7 +2672,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_apub" name = "lemmy_apub"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2710,7 +2710,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_perf" name = "lemmy_db_perf"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@ -2725,7 +2725,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_schema" name = "lemmy_db_schema"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"anyhow", "anyhow",
@ -2765,7 +2765,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_views" name = "lemmy_db_views"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"chrono", "chrono",
@ -2787,7 +2787,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_views_actor" name = "lemmy_db_views_actor"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"chrono", "chrono",
"diesel", "diesel",
@ -2807,7 +2807,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_views_moderator" name = "lemmy_db_views_moderator"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"diesel", "diesel",
"diesel-async", "diesel-async",
@ -2819,7 +2819,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_federate" name = "lemmy_federate"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"anyhow", "anyhow",
@ -2842,7 +2842,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_routes" name = "lemmy_routes"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2867,7 +2867,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_server" name = "lemmy_server"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-cors", "actix-cors",
@ -2910,7 +2910,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_utils" name = "lemmy_utils"
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"anyhow", "anyhow",

View File

@ -1,5 +1,5 @@
[workspace.package] [workspace.package]
version = "0.19.4-beta.4" version = "0.19.4-beta.5"
edition = "2021" edition = "2021"
description = "A link aggregator for the fediverse" description = "A link aggregator for the fediverse"
license = "AGPL-3.0" license = "AGPL-3.0"
@ -88,17 +88,17 @@ unused_self = "deny"
unwrap_used = "deny" unwrap_used = "deny"
[workspace.dependencies] [workspace.dependencies]
lemmy_api = { version = "=0.19.4-beta.4", path = "./crates/api" } lemmy_api = { version = "=0.19.4-beta.5", path = "./crates/api" }
lemmy_api_crud = { version = "=0.19.4-beta.4", path = "./crates/api_crud" } lemmy_api_crud = { version = "=0.19.4-beta.5", path = "./crates/api_crud" }
lemmy_apub = { version = "=0.19.4-beta.4", path = "./crates/apub" } lemmy_apub = { version = "=0.19.4-beta.5", path = "./crates/apub" }
lemmy_utils = { version = "=0.19.4-beta.4", path = "./crates/utils", default-features = false } lemmy_utils = { version = "=0.19.4-beta.5", path = "./crates/utils", default-features = false }
lemmy_db_schema = { version = "=0.19.4-beta.4", path = "./crates/db_schema" } lemmy_db_schema = { version = "=0.19.4-beta.5", path = "./crates/db_schema" }
lemmy_api_common = { version = "=0.19.4-beta.4", path = "./crates/api_common" } lemmy_api_common = { version = "=0.19.4-beta.5", path = "./crates/api_common" }
lemmy_routes = { version = "=0.19.4-beta.4", path = "./crates/routes" } lemmy_routes = { version = "=0.19.4-beta.5", path = "./crates/routes" }
lemmy_db_views = { version = "=0.19.4-beta.4", path = "./crates/db_views" } lemmy_db_views = { version = "=0.19.4-beta.5", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.19.4-beta.4", path = "./crates/db_views_actor" } lemmy_db_views_actor = { version = "=0.19.4-beta.5", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.19.4-beta.4", path = "./crates/db_views_moderator" } lemmy_db_views_moderator = { version = "=0.19.4-beta.5", path = "./crates/db_views_moderator" }
lemmy_federate = { version = "=0.19.4-beta.4", path = "./crates/federate" } lemmy_federate = { version = "=0.19.4-beta.5", path = "./crates/federate" }
activitypub_federation = { version = "0.5.4", default-features = false, features = [ activitypub_federation = { version = "0.5.4", default-features = false, features = [
"actix-web", "actix-web",
] } ] }

View File

@ -43,10 +43,6 @@ impl LocalUserLanguage {
}; };
let conn = &mut get_conn(pool).await?; let conn = &mut get_conn(pool).await?;
conn
.build_transaction()
.run(|conn| {
Box::pin(async move {
let langs = local_user_language let langs = local_user_language
.filter(local_user_id.eq(for_local_user_id)) .filter(local_user_id.eq(for_local_user_id))
.order(language_id) .order(language_id)
@ -54,9 +50,6 @@ impl LocalUserLanguage {
.get_results(conn) .get_results(conn)
.await?; .await?;
convert_read_languages(conn, langs).await convert_read_languages(conn, langs).await
}) as _
})
.await
} }
/// Update the user's languages. /// Update the user's languages.
@ -90,24 +83,33 @@ impl LocalUserLanguage {
.build_transaction() .build_transaction()
.run(|conn| { .run(|conn| {
Box::pin(async move { Box::pin(async move {
use crate::schema::local_user_language::dsl::{local_user_id, local_user_language}; use crate::schema::local_user_language::dsl::{
// Clear the current user languages language_id,
delete(local_user_language.filter(local_user_id.eq(for_local_user_id))) local_user_id,
.execute(conn) local_user_language,
.await?; };
// Delete old languages, not including new languages
let delete_old = delete(local_user_language)
.filter(local_user_id.eq(for_local_user_id))
.filter(language_id.ne_all(&lang_ids))
.execute(conn);
let forms = lang_ids let forms = lang_ids
.into_iter() .iter()
.map(|l| LocalUserLanguageForm { .map(|&l| LocalUserLanguageForm {
local_user_id: for_local_user_id, local_user_id: for_local_user_id,
language_id: l, language_id: l,
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
insert_into(local_user_language) // Insert new languages
let insert_new = insert_into(local_user_language)
.values(forms) .values(forms)
.execute(conn) .on_conflict((language_id, local_user_id))
.await?; .do_nothing()
.execute(conn);
tokio::try_join!(delete_old, insert_new)?;
Ok(()) Ok(())
}) as _ }) as _
}) })
@ -159,25 +161,30 @@ impl SiteLanguage {
.build_transaction() .build_transaction()
.run(|conn| { .run(|conn| {
Box::pin(async move { Box::pin(async move {
use crate::schema::site_language::dsl::{site_id, site_language}; use crate::schema::site_language::dsl::{language_id, site_id, site_language};
// Clear the current languages // Delete old languages, not including new languages
delete(site_language.filter(site_id.eq(for_site_id))) let delete_old = delete(site_language)
.execute(conn) .filter(site_id.eq(for_site_id))
.await?; .filter(language_id.ne_all(&lang_ids))
.execute(conn);
let forms = lang_ids let forms = lang_ids
.into_iter() .iter()
.map(|l| SiteLanguageForm { .map(|&l| SiteLanguageForm {
site_id: for_site_id, site_id: for_site_id,
language_id: l, language_id: l,
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
insert_into(site_language) // Insert new languages
let insert_new = insert_into(site_language)
.values(forms) .values(forms)
.get_result::<Self>(conn) .on_conflict((site_id, language_id))
.await?; .do_nothing()
.execute(conn);
tokio::try_join!(delete_old, insert_new)?;
CommunityLanguage::limit_languages(conn, instance_id).await?; CommunityLanguage::limit_languages(conn, instance_id).await?;
@ -278,8 +285,8 @@ impl CommunityLanguage {
} }
let form = lang_ids let form = lang_ids
.into_iter() .iter()
.map(|language_id| CommunityLanguageForm { .map(|&language_id| CommunityLanguageForm {
community_id: for_community_id, community_id: for_community_id,
language_id, language_id,
}) })
@ -289,25 +296,25 @@ impl CommunityLanguage {
.build_transaction() .build_transaction()
.run(|conn| { .run(|conn| {
Box::pin(async move { Box::pin(async move {
use crate::schema::community_language::dsl::{community_id, community_language}; use crate::schema::community_language::dsl::{
use diesel::result::DatabaseErrorKind::UniqueViolation; community_id,
// Clear the current languages community_language,
delete(community_language.filter(community_id.eq(for_community_id))) language_id,
.execute(conn) };
.await?; // Delete old languages, not including new languages
let delete_old = delete(community_language)
.filter(community_id.eq(for_community_id))
.filter(language_id.ne_all(&lang_ids))
.execute(conn);
let insert_res = insert_into(community_language) // Insert new languages
let insert_new = insert_into(community_language)
.values(form) .values(form)
.get_result::<Self>(conn) .on_conflict((community_id, language_id))
.await; .do_nothing()
.execute(conn);
if let Err(Error::DatabaseError(UniqueViolation, _info)) = insert_res { tokio::try_join!(delete_old, insert_new)?;
// race condition: this function was probably called simultaneously from another caller. ignore error
// tracing::warn!("unique error: {_info:#?}");
// _info.constraint_name() should be = "community_language_community_id_language_id_key"
return Ok(());
}
insert_res?;
Ok(()) Ok(())
}) as _ }) as _

@ -1 +1 @@
Subproject commit c88dd1e3b36ee1617f1b86acf94c1b7946e97cd4 Subproject commit 866e4056656755f7b31e20094b46391e6931e3e7

View File

@ -0,0 +1,120 @@
DROP INDEX idx_post_aggregates_community_active;
DROP INDEX idx_post_aggregates_community_controversy;
DROP INDEX idx_post_aggregates_community_hot;
DROP INDEX idx_post_aggregates_community_most_comments;
DROP INDEX idx_post_aggregates_community_newest_comment_time;
DROP INDEX idx_post_aggregates_community_newest_comment_time_necro;
DROP INDEX idx_post_aggregates_community_published;
DROP INDEX idx_post_aggregates_community_published_asc;
DROP INDEX idx_post_aggregates_community_scaled;
DROP INDEX idx_post_aggregates_community_score;
DROP INDEX idx_post_aggregates_featured_community_active;
DROP INDEX idx_post_aggregates_featured_community_controversy;
DROP INDEX idx_post_aggregates_featured_community_hot;
DROP INDEX idx_post_aggregates_featured_community_most_comments;
DROP INDEX idx_post_aggregates_featured_community_newest_comment_time;
DROP INDEX idx_post_aggregates_featured_community_newest_comment_time_necr;
DROP INDEX idx_post_aggregates_featured_community_published;
DROP INDEX idx_post_aggregates_featured_community_published_asc;
DROP INDEX idx_post_aggregates_featured_community_scaled;
DROP INDEX idx_post_aggregates_featured_community_score;
DROP INDEX idx_post_aggregates_featured_local_active;
DROP INDEX idx_post_aggregates_featured_local_controversy;
DROP INDEX idx_post_aggregates_featured_local_hot;
DROP INDEX idx_post_aggregates_featured_local_most_comments;
DROP INDEX idx_post_aggregates_featured_local_newest_comment_time;
DROP INDEX idx_post_aggregates_featured_local_newest_comment_time_necro;
DROP INDEX idx_post_aggregates_featured_local_published;
DROP INDEX idx_post_aggregates_featured_local_published_asc;
DROP INDEX idx_post_aggregates_featured_local_scaled;
DROP INDEX idx_post_aggregates_featured_local_score;
CREATE INDEX idx_post_aggregates_community_active ON public.post_aggregates USING btree (community_id, featured_local DESC, hot_rank_active DESC, published DESC);
CREATE INDEX idx_post_aggregates_community_controversy ON public.post_aggregates USING btree (community_id, featured_local DESC, controversy_rank DESC);
CREATE INDEX idx_post_aggregates_community_hot ON public.post_aggregates USING btree (community_id, featured_local DESC, hot_rank DESC, published DESC);
CREATE INDEX idx_post_aggregates_community_most_comments ON public.post_aggregates USING btree (community_id, featured_local DESC, comments DESC, published DESC);
CREATE INDEX idx_post_aggregates_community_newest_comment_time ON public.post_aggregates USING btree (community_id, featured_local DESC, newest_comment_time DESC);
CREATE INDEX idx_post_aggregates_community_newest_comment_time_necro ON public.post_aggregates USING btree (community_id, featured_local DESC, newest_comment_time_necro DESC);
CREATE INDEX idx_post_aggregates_community_published ON public.post_aggregates USING btree (community_id, featured_local DESC, published DESC);
CREATE INDEX idx_post_aggregates_community_published_asc ON public.post_aggregates USING btree (community_id, featured_local DESC, public.reverse_timestamp_sort (published) DESC);
CREATE INDEX idx_post_aggregates_community_scaled ON public.post_aggregates USING btree (community_id, featured_local DESC, scaled_rank DESC, published DESC);
CREATE INDEX idx_post_aggregates_community_score ON public.post_aggregates USING btree (community_id, featured_local DESC, score DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_community_active ON public.post_aggregates USING btree (community_id, featured_community DESC, hot_rank_active DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_community_controversy ON public.post_aggregates USING btree (community_id, featured_community DESC, controversy_rank DESC);
CREATE INDEX idx_post_aggregates_featured_community_hot ON public.post_aggregates USING btree (community_id, featured_community DESC, hot_rank DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_community_most_comments ON public.post_aggregates USING btree (community_id, featured_community DESC, comments DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_community_newest_comment_time ON public.post_aggregates USING btree (community_id, featured_community DESC, newest_comment_time DESC);
CREATE INDEX idx_post_aggregates_featured_community_newest_comment_time_necr ON public.post_aggregates USING btree (community_id, featured_community DESC, newest_comment_time_necro DESC);
CREATE INDEX idx_post_aggregates_featured_community_published ON public.post_aggregates USING btree (community_id, featured_community DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_community_published_asc ON public.post_aggregates USING btree (community_id, featured_community DESC, public.reverse_timestamp_sort (published) DESC);
CREATE INDEX idx_post_aggregates_featured_community_scaled ON public.post_aggregates USING btree (community_id, featured_community DESC, scaled_rank DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_community_score ON public.post_aggregates USING btree (community_id, featured_community DESC, score DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_local_active ON public.post_aggregates USING btree (featured_local DESC, hot_rank_active DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_local_controversy ON public.post_aggregates USING btree (featured_local DESC, controversy_rank DESC);
CREATE INDEX idx_post_aggregates_featured_local_hot ON public.post_aggregates USING btree (featured_local DESC, hot_rank DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_local_most_comments ON public.post_aggregates USING btree (featured_local DESC, comments DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_local_newest_comment_time ON public.post_aggregates USING btree (featured_local DESC, newest_comment_time DESC);
CREATE INDEX idx_post_aggregates_featured_local_newest_comment_time_necro ON public.post_aggregates USING btree (featured_local DESC, newest_comment_time_necro DESC);
CREATE INDEX idx_post_aggregates_featured_local_published ON public.post_aggregates USING btree (featured_local DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_local_published_asc ON public.post_aggregates USING btree (featured_local DESC, public.reverse_timestamp_sort (published) DESC);
CREATE INDEX idx_post_aggregates_featured_local_scaled ON public.post_aggregates USING btree (featured_local DESC, scaled_rank DESC, published DESC);
CREATE INDEX idx_post_aggregates_featured_local_score ON public.post_aggregates USING btree (featured_local DESC, score DESC, published DESC);

View File

@ -0,0 +1,121 @@
-- Add , post_id DESC to all these
DROP INDEX idx_post_aggregates_community_active;
DROP INDEX idx_post_aggregates_community_controversy;
DROP INDEX idx_post_aggregates_community_hot;
DROP INDEX idx_post_aggregates_community_most_comments;
DROP INDEX idx_post_aggregates_community_newest_comment_time;
DROP INDEX idx_post_aggregates_community_newest_comment_time_necro;
DROP INDEX idx_post_aggregates_community_published;
DROP INDEX idx_post_aggregates_community_published_asc;
DROP INDEX idx_post_aggregates_community_scaled;
DROP INDEX idx_post_aggregates_community_score;
DROP INDEX idx_post_aggregates_featured_community_active;
DROP INDEX idx_post_aggregates_featured_community_controversy;
DROP INDEX idx_post_aggregates_featured_community_hot;
DROP INDEX idx_post_aggregates_featured_community_most_comments;
DROP INDEX idx_post_aggregates_featured_community_newest_comment_time;
DROP INDEX idx_post_aggregates_featured_community_newest_comment_time_necr;
DROP INDEX idx_post_aggregates_featured_community_published;
DROP INDEX idx_post_aggregates_featured_community_published_asc;
DROP INDEX idx_post_aggregates_featured_community_scaled;
DROP INDEX idx_post_aggregates_featured_community_score;
DROP INDEX idx_post_aggregates_featured_local_active;
DROP INDEX idx_post_aggregates_featured_local_controversy;
DROP INDEX idx_post_aggregates_featured_local_hot;
DROP INDEX idx_post_aggregates_featured_local_most_comments;
DROP INDEX idx_post_aggregates_featured_local_newest_comment_time;
DROP INDEX idx_post_aggregates_featured_local_newest_comment_time_necro;
DROP INDEX idx_post_aggregates_featured_local_published;
DROP INDEX idx_post_aggregates_featured_local_published_asc;
DROP INDEX idx_post_aggregates_featured_local_scaled;
DROP INDEX idx_post_aggregates_featured_local_score;
CREATE INDEX idx_post_aggregates_community_active ON public.post_aggregates USING btree (community_id, featured_local DESC, hot_rank_active DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_community_controversy ON public.post_aggregates USING btree (community_id, featured_local DESC, controversy_rank DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_community_hot ON public.post_aggregates USING btree (community_id, featured_local DESC, hot_rank DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_community_most_comments ON public.post_aggregates USING btree (community_id, featured_local DESC, comments DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_community_newest_comment_time ON public.post_aggregates USING btree (community_id, featured_local DESC, newest_comment_time DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_community_newest_comment_time_necro ON public.post_aggregates USING btree (community_id, featured_local DESC, newest_comment_time_necro DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_community_published ON public.post_aggregates USING btree (community_id, featured_local DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_community_published_asc ON public.post_aggregates USING btree (community_id, featured_local DESC, public.reverse_timestamp_sort (published) DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_community_scaled ON public.post_aggregates USING btree (community_id, featured_local DESC, scaled_rank DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_community_score ON public.post_aggregates USING btree (community_id, featured_local DESC, score DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_active ON public.post_aggregates USING btree (community_id, featured_community DESC, hot_rank_active DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_controversy ON public.post_aggregates USING btree (community_id, featured_community DESC, controversy_rank DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_hot ON public.post_aggregates USING btree (community_id, featured_community DESC, hot_rank DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_most_comments ON public.post_aggregates USING btree (community_id, featured_community DESC, comments DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_newest_comment_time ON public.post_aggregates USING btree (community_id, featured_community DESC, newest_comment_time DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_newest_comment_time_necr ON public.post_aggregates USING btree (community_id, featured_community DESC, newest_comment_time_necro DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_published ON public.post_aggregates USING btree (community_id, featured_community DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_published_asc ON public.post_aggregates USING btree (community_id, featured_community DESC, public.reverse_timestamp_sort (published) DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_scaled ON public.post_aggregates USING btree (community_id, featured_community DESC, scaled_rank DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_community_score ON public.post_aggregates USING btree (community_id, featured_community DESC, score DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_active ON public.post_aggregates USING btree (featured_local DESC, hot_rank_active DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_controversy ON public.post_aggregates USING btree (featured_local DESC, controversy_rank DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_hot ON public.post_aggregates USING btree (featured_local DESC, hot_rank DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_most_comments ON public.post_aggregates USING btree (featured_local DESC, comments DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_newest_comment_time ON public.post_aggregates USING btree (featured_local DESC, newest_comment_time DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_newest_comment_time_necro ON public.post_aggregates USING btree (featured_local DESC, newest_comment_time_necro DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_published ON public.post_aggregates USING btree (featured_local DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_published_asc ON public.post_aggregates USING btree (featured_local DESC, public.reverse_timestamp_sort (published) DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_scaled ON public.post_aggregates USING btree (featured_local DESC, scaled_rank DESC, published DESC, post_id DESC);
CREATE INDEX idx_post_aggregates_featured_local_score ON public.post_aggregates USING btree (featured_local DESC, score DESC, published DESC, post_id DESC);