Not going to disagree, there are most likely some things we could do more efficiently here.
Let's take a step back quickly though. Are you using the Orion DB as your primary log storage mechanism for syslog and traps? What are your requirements around this?
Reason I ask is what many customers do it leverage our Kiwi Syslog server in a distributed manner for complete logging so they can archive those off on a periodic basis for auditors and then forward up the critical events to Orion for alerting etc.
Not sure if this is something that is an option for you.