I have a table with thousands of entry and want to show if the entity is deleted or not.
I can add a new column "isDeleted" in the existing table and update every entry(thousands) of that entity in the table once it is deleted
OR
have a new table for the deleted entries and join the tables for queries. I want to know which is faster.
I will be querying from the table and want the information about deleted entities as well as non deleted ones.
Lets say my table has columns:
id | type | prop1 | info1 |
---|---|---|---|
1 | A | any | any |
2 | B | any | any |
3 | C | any | any |
4 | A | any | any |
5 | B | any | any |
And i go and delete the type A, now I can have a isDeleted Column in this table only, as such
id | type | prop1 | info1 | isDeleted |
---|---|---|---|---|
1 | A | any | any | true |
2 | B | any | any | false |
3 | C | any | any | false |
4 | A | any | any | true |
5 | B | any | any | false |
or have a new table for deleted types.
with the first method I will have to go and update the isDeleted column for every instance of type A, and there are 1000's of such entries. whereas in the second method i can simply add a new row in the new table.
I want all such unique "types" that have not been deleted from my table. but dont want to remove the deleted types information
I hope this is clearer