Documentation Home
MySQL Internals Manual

MySQL Internals Manual  /  Writing a Custom Storage Engine  /  Adding Support for DELETE to a Storage Engine

23.14 Adding Support for DELETE to a Storage Engine

The MySQL server executes DELETE statements using the same approach as for UPDATE statements: It advances to the row to be deleted using the rnd_next() method and then calls the [custom-engine.html#custom-engine-api-reference-delete_row delete_row()] method to delete the row:

int ha_foo::delete_row(const byte *buf)

The *buf parameter contains the contents of the row to be deleted. For non-indexed storage engines the parameter can be ignored, but transactional storage engines may need to store the deleted data for rollback purposes.

The following example is from the CSV storage engine:

int ha_tina::delete_row(const byte * buf)

   if (chain_append())



The steps of note in the preceding example are the update of the delete_count statistic and the record count.