MySQL: Sharing a good way to handle deletions?

I have a MySQL table:

CREATE TABLE responses (
    id INT NOT NULL AUTO_INCREMENT,
    other_id INT NOT NULL,
    details TEXT,
    deleted BOOLEAN,
    PRIMARY KEY (id)
);

Users can delete entries in responses.

My plan is to use the field deletedto implement the deletion. Every time a user deletes a record, I set deletedto 1.

From time to time I can get rid of all deleted records or archive them. I am thinking about using split to make it faster:

PARTITION BY LIST(deleted) (
    PARTITION pActive VALUES IN (0),
    PARTITION pDeleted VALUES IN (1)
);

My question is, will this make the action slower? Now, when I change the record to the β€œremote” field, MySQL will have to move the record to a completely different section. It seems like it can be slow.

Any suggestions are welcome.

+3
2

, , , . / , , , .

, , , .

+3

, , , . , . , , , , , , "" , , . , .

, , . ( ), .

. , , . , , - , ​​, , "" ( , ). false ? , , 2 ? deleted ? , .

+3

Source: https://habr.com/ru/post/1773434/


All Articles