Linked Questions

6
votes
2answers
9k views

Implementing soft delete

Could someone please show or describe to me how to implement soft deletes? I have table of vouchers with these fields: id, username, password, serial. I want to display a given number of rows ...
5
votes
2answers
765 views

Keep ROW = NULL or DELETE it?

in this scheme id uid content 1 1 A 2 1 B 3 1 C 4 1 D 5 1 E If the User decided that he doesn't need the rows with id = 3, 4, 5 Is it better to make him ...
2
votes
2answers
6k views

Massive MySQL delete from CSV file

To insert massive CSV file into MySQL, there is LOAD DATA INFILE, but is there any similar command to delete massive entries with keys stored in a massive CSV file? If not, what would you see as the ...
3
votes
2answers
1k views

Should I drop a foreign key if I use a soft delete?

"ON UPDATE" scenario never happens in my application. As soft delete is used, "ON DELETE" cascade and restrict scenario never happen as well now. Then, should I just drop foreign key because I have ...
0
votes
2answers
2k views

Best way to store deleted rows

I have a table with operations that can be deleted by users. What happens, is that I want to store deleted rows for some time, to serve as recover in case any client regrets the deletion. One of the ...
1
vote
1answer
2k views

Delete by primary key takes too long

What would make a query that deletes a row using the primary key of the table .. take too long ? This is a table with about 1.4M rows that gets .. 70%/30% read/write . I don't know where to look. ...
1
vote
2answers
696 views

Should I stop an awfully inefficient MySQL DELETE statement?

I'm running the following statement on MySQL 5.5 in a 1GB 1CPU SSD virtual machine from Linode: DELETE table FROM ( SELECT MAX(id) id, field FROM table GROUP BY field ) temp_table INNER ...
1
vote
2answers
156 views

how to use an index on a mysql query with a where clause and a order by

I have a table CREATE TABLE activity ( id INT(10) UNSIGNED AUTO_INCREMENT, subscriberid INT(10) UNSIGNED NOT NULL DEFAULT '0', action VARCHAR(250) NOT NULL DEFAULT '', ip INT(10) UNSIGNED NOT ...
0
votes
1answer
102 views

ON DELETE CASCADE pseudo delete

For data integrity ON DELETE CASCADE is necessary but it's really dangerous when a delete affects like a Chain Reaction! I know one way to prevent this is to make a pseudo delete by putting a "Delete"...
1
vote
0answers
126 views

created_at, modified_at, status - is this a documented pattern?

I am but a lowly code monkey, so this may be a very basic question. For the current project, our architect has required that all tables, without exception, must have at least these four fields: `id` ...