Drush has a number of options to exclude tables from sql-dump. These all now support wildcards (thanks @MPD for pointing this out), so for example you can do this:
drush sql-dump --skip-tables-list='result-*'
This will completely exclude any tables matching the pattern result-*
- that is, beginning with result-
- from the dump. You can pass multiple patterns (or individual table names) by separating them with commas. The quotes are necessary to prevent your shell from expanding the pattern.
If you want the tables' structure to be included but just not the data in them, use --structure-tables-list
instead.
The other options are --skip-tables-key
and --structure-tables-key
which work similarly, but instead of providing the table names or patterns directly on the command line, you add them to an array in drushrc.php and specify the array key on the command line. This is useful if you have a set of tables that you routinely exclude, such as 'cache_*'. The example.drushrc.php provided with drush gives the following example:
/**
* List of tables whose *data* is skipped by the 'sql-dump' and 'sql-sync'
* commands when the "--structure-tables-key=common" option is provided.
* You may add specific tables to the existing array or add a new element.
*/
# $options['structure-tables']['common'] = array('cache', 'cache_*', 'history', 'search_*', 'sessions', 'watchdog');