Add soft delete for statuses for instant deletes through API#11623
Add soft delete for statuses for instant deletes through API#11623
Conversation
|
What are the performance implications of that? |
Not entirely sure, unfortunately. PG picks different query plans depending on table size so getting real performance estimates in development is hard.
Yes, but because discarding and queueing removal worker happens at the same time, I feel like we don't need to care about those. |
4e2d9cb to
2225ca4
Compare
|
I have updated the index for the slowest query, getting an account's statuses. I believe the queries for public timelines will not benefit from other changes. |
| def up | ||
| safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], where: 'deleted_at IS NULL', order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20190820 } | ||
| remove_index :statuses, name: :index_statuses_20180106 | ||
| end |
There was a problem hiding this comment.
I don't fully understand this, so I can't comment on that, and I don't understand the performance implications, which I am worried about.
Other than that, looks fine to me
There was a problem hiding this comment.
So, the index is made smaller by limiting it to rows that have a null deleted_at. Because the index is mainly used for queries that ask for rows where the deleted_at column is null (as that is the default scope), it will work like before, and not need to add a further filter for deleted_at in the query planner.
2225ca4 to
93d6b22
Compare
…n#11623) * Add soft delete for statuses to allow them to appear instant * Allow reporting soft-deleted statuses and show them in the admin UI * Change index for getting an account's statuses
Uh oh!
There was an error while loading. Please reload this page.