Build a Python script for automated database index optimization — Development Task