Correct way to cleanup DB table query_execution

Sometimes (usually when doing a DB backup) I did DB cleanup for tables below

TRUNCATE TABLE query_execution;
TRUNCATE TABLE view_log;

But since v 0.50.x cannot do this for DB table query_execution, because

Cannot truncate a table referenced in a foreign key constraint 

What is the correct way to do it now ? I really don't want to back up this data, it makes the file too big.

I think it's automatically trimmed after a certain number of days now.
For the open source version, view_log is no longer populated.
In theory, you could try a truncate cascade if it's supported. Problem is that you may delete something important!

Are you sure there's some trimming?
In my query_execution table I have records 4 months old (when I deleted it last).

I deleted it last week as below and there seems to be no problem. Now the DB backup is half the size (600MB>300MB).

TRUNCATE TABLE field_usage;
DELETE FROM query_execution;
ALTER TABLE query_execution AUTO_INCREMENT = 1;

Depends what version you are running?

Curently v0.50.16

Maybe it's not trimmed after all (I was sure it was in some release notes).
My production DB has records going back to 2022.