I added your mentioned alter table index. Took 4.375 secs in MySQL Workbench. It did speed up the results. I'll have to try another method of importing to see if I can improve this. I also ommitted the overhead of converting variables for display output measurements, because they were included in the C++ times. If we were to compare the two, it as folllows:
Query Duration / Fetch
C++: 0.30402 sec
MWB: 0.000 sec / 0.297 sec
WHERE:
C++: 0.018953 sec
MWB: 0.000 sec / 0.000 sec
HAVING:
C++: 0.0626546 sec
MWB: 0.062 sec / 0.000 sec
I don't consider this bad at all for connecting to it through localhost. Let's not talk about display times. :)