LEFT JOINS are not very effective in this case. Typically select via archiveID will do a many full table joins before WHERE is executed. So in my test case I'm from ~70 seconds to under one second.
I've done few more changes here, so please review logic thoroughly.
LEFT JOINS are not very effective in this case. Typically select via
archiveIDwill do a many full table joins before WHERE is executed. So in my test case I'm from ~70 seconds to under one second.I've done few more changes here, so please review logic thoroughly.