Performing actions on many tables
As a database administrator, you will often need to apply multiple commands as part of the same overall task. This task could be one of the following:
- Performing many different actions on multiple tables
- Performing the same action on multiple tables
- Performing the same action on multiple tables in parallel
- Performing different actions, one on each table, in parallel
The first is a general case where you need to make a set of coordinated changes. The solution is to write a script, as we've already discussed. We can also call this static scripting because you write the script manually and then execute it.
The second type of task can be achieved very simply with dynamic scripts, where we write a script that writes another script. This technique is the main topic of this recipe.
Performing actions in parallel sounds cool, and it would be useful if it were easy. In some ways...