prune_objects can prune orphaned activities who reference an array of objects
authorilja <git@ilja.space>
Sun, 8 Jan 2023 17:22:53 +0000 (18:22 +0100)
committerilja <git@ilja.space>
Sun, 26 Feb 2023 13:41:50 +0000 (14:41 +0100)
commit57eef6d76492e772f83acba2402d50ecb6a69f6b
treea1eeaf84cd58efb8dd2956882f9fd22cc579d0e6
parenta7ec6e039cdc9ca5a0cc744fbd51511c5ede9f29
prune_objects can prune orphaned activities who reference an array of objects

E.g. Flag activities have an array of objects

We prune the activity when NONE of the objects can be found

Note that the cost of finding and deleting these is ~4x higher than finding and deleting the non-array ones

Only string:
Delete on activities  (cost=506573.48..506580.38 rows=0 width=0)

Only Array:
Delete on activities  (cost=3570359.68..4276365.34 rows=0 width=0)

(They are still executed separately, so the total cost is the sum of the two)
lib/mix/tasks/pleroma/database.ex
test/mix/tasks/pleroma/database_test.exs