Given the simple code below:
cur.execute("SELECT * FROM myTable")
for row in cur.fetchall():
process(row)
If the database is large, this will take a long time to process all the rows. How do I use multi-threading here to help me? Specifically, each row should only be processed once, so when multi-threading, each thread should only process on ID.
Do I need to basically get the total length of database, decide how many threads I want, and then basically tell each thread the min/max id it should filter through?