Best way to delete all variables when uninstalling module I'm writing a module that writes several variables (three, four variables for every content type, and other).

Which method should I use to delete them on hook_uninstall?

Is it safe to perform a query, searching "mymodule_*" variables?

Or should I loop for content types and search variabels, so call many times variable_del?
Variables are cached, so deleting manually is fine so long as you invalidate that cache, e.g.

db_delete('variable')
  -&gt;condition('name', 'mymodule_%', 'LIKE')
  -&gt;execute();

cache_clear_all('variables', 'cache_bootstrap');