ARP generator - optimise sql(s)

No reduntant sql queries are triggered