does cleaning up only involve the IDO database backend, or is it about logs and configuration in a distributed setup as well?
Which data should be cleaned, only the one visible in the web interface or everything? Typically the main entry point in the schema are the object_ids which can be fetched from the icinga_objects table. Using this, you may iterate all tables, remember the foreign key (FK - host_object_id, service_object_id, etc.) and purge rows away. Depending on the size of your database, this may take quite a bit - test that up front and schedule a maintainance window for production then.
my focus relies on cleaning IDO database and (visible) history. Before going live there are typically (application) config changes, reboots, etc., hence, many monitoring events. One thing is to avoid risk of misinterpretation. Second to cleanup events as they otherwise might run into SLA reports.
There is always only one relation (based on object_id) to take care about?
The database schema is still the old 1.x model which is documented here. Depending on what you want to delete (likely history, config and status), select the object ids first and then fire away. I would advise to do that with a backup copy first to see the impact though.