User Tools

Site Tools


mysql:finding_and_deleting_orphaned_rows

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mysql:finding_and_deleting_orphaned_rows [2016/07/19 13:30] – created petermysql:finding_and_deleting_orphaned_rows [2020/07/15 09:30] (current) – external edit 127.0.0.1
Line 31: Line 31:
  
 The treatment of child rows with a NULL parent_id will vary depending on the requirements of your application, but in general I do not count NULL values as orphans. Thus in my queries above I explicitly check that **child.rental_id** is not NULL. The treatment of child rows with a NULL parent_id will vary depending on the requirements of your application, but in general I do not count NULL values as orphans. Thus in my queries above I explicitly check that **child.rental_id** is not NULL.
-What not to do+ 
 + 
 +===== What not to do =====
  
 I’ve also seen people write queries like the following to find orphaned rows.  In general this will be slower, especially if you are running an older version of MySQL, so I do not recommend this method: I’ve also seen people write queries like the following to find orphaned rows.  In general this will be slower, especially if you are running an older version of MySQL, so I do not recommend this method:
mysql/finding_and_deleting_orphaned_rows.1468935007.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki