When you have one connection object, can you make multiple cursors to that one single connection and execute queries with these cursors at the same time? Or would each cursor wait for the previous cursor to finish its query?
connection type: database=MySQLdb.connect(...) cursor: curs=database.cursor() querying: curs.execute("query")
The MySQLdb documentation states (scroll down a little further to threadsafety): The general upshot of this is: Don't share connections between threads. It's really not worth your effort or mine, and in the end, will probably hurt performance, since the MySQL server runs a separate thread for each connection.
You'll need to open multiple connections. Mysqldb is threadsafe, so each connection will be able to access their respective cursors, queries and result sets without having an effect on the other connections but each thread or process will need its own connection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With