I've got a postgres db with nearly 200'000 network address types. I'd like to detect if some subnets are overlapping themselves, for ex, detect 123.0.0.0/16, 123.2.0.0/24 and 123.3.4.128/30 and report them.
I'm already using a lot of python scripts and netaddr library.
Considering the number of entries, what would be the best approach/algorithm to detect overlaps?
I'm pretty sure there's a better way than comparing each entry to the whole database.