What is the best way to implement soft deletion?
You could perform all of your queries against a view that contains the WHERE IS_DELETED='0'
clause.
Implementing soft delete with minimal impact on performance and code
If the key is numeric, I handle a "soft-delete" by negating the key. (Of course, won't work for identity keys). You don't need to change your code at all, and can easily restore the record by multiplying by -1.
Just another approach to give some thought to... If the key is alphanumeric, you can do something similar by prepending a unique "marker" characters. Since deleted records will all begin with this marker, then will end up off by themselves in the index.
Related Topics
T-SQL Calculate Moving Average
Pseudo_Encrypt() Function in Plpgsql That Takes Bigint
Create Date from Day, Month, Year Fields in MySQL
How Universal Is the Limit Statement in SQL
MySQL Subquery Returns More Than One Row
Check Whether String Is a Date Postgresql
Opinions on Sensor/Reading/Alert Database Design
SQL Server: Find Out Default Value of a Column with a Query
Creating or Simulating Two Dimensional Arrays in Pl/Sql
Scope_Identity VS Ident_Current
How to Join Two Recordset Created from Two Different Data Source in Excel Vba
Select Statement to Return Parent and Infinite Children
MySQL Full Text Search with Partial Words
How to Copy a Record in a SQL Table But Swap Out the Unique Id of the New Row
The Object 'Df_*' Is Dependent on Column '*' - Changing Int to Double