You have to create a macro for it. All the tools to do so should be available with the Dictionaries and Dictionary Keys collections.
They stay on disk forever until you erase them.
They are on disk, in a database, so in theory that would be ok. I think. It is well beyond the design parameters for Keyboard Maestro’s dictionaries, and frankly Keyboard Maestro actions do not run fast enough to work well for 10 million anything. Keyboard Maestro executes actions at well less than 1000 per second. For instance, this trivial loop:
Clocks in at 0.0023 seconds per iteration, which is about right, 0.001 for each loop of the for loop, and 0.001 for each Set Variable to Calculation in the loop.
So to deal with 10 million anything is going to take 3 hours per action involved in the loop.