New answers tagged

-1 votes

MySQL DELETE statement doesn't use index although the same SELECT query does

May be you can try like this: EXPLAIN DELETE d.* FROM data d WHERE country='Y' and category='X'
leely chen's user avatar
1 vote

SELECT / DELETE rows where consecutive null value count is greater than N

To just select: SELECT * FROM ( SELECT *, count(*) OVER (PARTITION BY receiver, grp) AS grp_count FROM ( SELECT *, count(recv_time) OVER (PARTITION BY receiver ORDER BY send_time) AS grp ...
Erwin Brandstetter's user avatar
0 votes

Keep the foreign key constraint using soft delete

Using soft deletes invariably leads to more complex SQL because you're having to allow for things that exists, but that you want to treat as if they didn't. That said, it is only one extra element on ...
Phill  W.'s user avatar
  • 8,118
1 vote

Keep the foreign key constraint using soft delete

You could make <primary key> plus <isdeleted> a composite unique key, and reference that in the foreign keys instead of the primary key, though this would feel a bit dirty to me. You would ...
David Spillett's user avatar

Top 50 recent answers are included