Skip to content

Stop using deleted_at to filter out namespaces/projects for pending removal

Whenever we query the namespaces or projects table we use WHERE deleted_at IS NULL to filter out any namespaces/projects that are pending removal. This is adds query overhead for no good reason, especially since in 99.99% of the cases namespaces/projects only stay in the pending-removal state for a very short period of time.

What I propose is the following:

  1. We stop filtering by deleted_at
  2. We replace deleted_at with pending_delete, we don't add any indexes for this column
  3. When display a namespace/project (e.g. in a list somewhere), we check if pending_delete is set (in the retrieved object, not in the query). If so, we add a label saying something like "Pending removal..."

User impact wise this means that after removing a namespace/project you may see it in a list somewhere for a few seconds. The label mentioned above is present to make it clear the namespace/project is being removed.

cc @jschatz1 since this will affect UX cc @DouweM @rspeicher @smcgivern for any strong opinions