-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add soft delete for statuses for instant deletes through API #11623
Conversation
Gargron
commented
Aug 19, 2019
•
edited
Loading
edited
- Fix bug where same status was fetched multiple times in the unreblog API
- Fix bug where reblogs of sensitive statuses were showing media without spoiler in admin UI
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
… instant deletes through API * 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