I have received contradictory responses when contacting different dealerships about replacing the battery in my 2005 Mazda3. Some dealerships claim that an idle-relearn procedure is always necessary, while others suggest that you have only a few minutes to swap the battery before most settings within the PCM (ECU) are lost. They also suggest buying a battery saver tool that plugs into your cigarette lighter. I don't have one of these.
I vaguely remember a friend from a long time ago who managed to complete the battery swap within a minute and didn't need to perform an idle-relearn. However, I'm uncertain whether he had to reset other settings like the radio and more.