Question on the foreman-rake facts:clean task

** We’re still on an old (very old) version of Foreman, 1.21. We are using the batch support fixes introduced here. My question, it’s taking a long time to clean up facts and I’m not sure why. Our fact_names table started with 64 million rows. It currently has 200k-ish. The fact_values table still has 3 million-ish. I’m currently running it with batch_size=100

For example, it takes 75s for the query: SELECT fact_names.* FROM fact_names WHERE (fact_names.ancestry LIKE 12341234/12341234/12341234/% or fact_names.ancestry = 12341234/12341234/12341234) ORDER by . The numbers in that are made up in this example.**

It should be faster? How can I speed it up?

Foreman and Proxy versions: 1.21 (I said it was old)

Distribution and version: OEL 7

Other relevant data: Currently have 186k fact_names and over 3 million fact_values. this is down from 2 weeks ago when I started the task and I had 203k fact_names and 80k more fact_values. 2 weeks, and this task is still running