DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(mysql.info.gz) Deleting from related tables

Info Catalog (mysql.info.gz) Non-transactional tables (mysql.info.gz) Query Issues (mysql.info.gz) No matching rows
 
 A.5.6 Deleting Rows from Related Tables
 ---------------------------------------
 
 MySQL does not support subqueries prior to Version 4.1, or the use of
 more than one table in the `DELETE' statement prior to Version 4.0. If
 your version of MySQL does not support subqueries or multiple-table
 `DELETE' statements, you can use the following approach to delete rows
 from two related tables:
 
   1. `SELECT' the rows based on some `WHERE' condition in the main
      table.
 
   2. `DELETE' the rows in the main table based on the same condition.
 
   3. `DELETE FROM related_table WHERE related_column IN
      (selected_rows)'.
 
 If the total length of the `DELETE' statement for `related_table' is
 more than 1MB (the default value of the `max_allowed_packet' system
 variable), you should split it into smaller parts and execute multiple
 `DELETE' statements.  You will probably get the fastest `DELETE' by
 specifying only 100 to 1,000 `related_column' values per statement if
 the `related_column' is indexed.  If the `related_column' isn't
 indexed, the speed is independent of the number of arguments in the
 `IN' clause.
 
Info Catalog (mysql.info.gz) Non-transactional tables (mysql.info.gz) Query Issues (mysql.info.gz) No matching rows
automatically generated byinfo2html