u/michaelnovati replied ·
1. This is unrelated, but the variable names have inconsistent capitalization, underscores, and inconsistent use of ID, id, Id, etc... is very confusing and a flag if I were looking at this.
2. Performance of SQL when you have millions of rows will depend a lot on the indexing you setup and schema.