MySQL select request in parallel (python) -
i saw "similar" post executing mysql select * query in parallel, buy question different, , has not been answered either, guess not duplicate.
i trying mysql select request in parallel. reason because need response fast. managed create request when paralleled connection well, connection takes more time actual select
faster connect 1 time, , select
in parallel.
my approach:
import mysql.connector import multiprocessing def func(id): return getfasta(id, cnx).sequence() cnx = mysql.connector.connect(user='u_name', host='ip_addr', database='db_name') p = multiprocessing.pool() x in p.imap_unordered(func, ["q32p44", "asd"]): print x p.close() p.join() cnx.close()
the getfasta
class
, working intended, requires connector, , id , simple select
those.
if execute script interpreter freezes, , have kill manually. guess either not trivial, or maybe impossible select
in parallel 1 connector.
is it?
any workaround?
i found "solution" after lot of research. not possible. mysql not support parallel queries same user. absolutely impossible, , there no plans add this.
the best can way implemented it, parallel connection well.
in other types of databases possible, ll stick mysql , use parallel connection method
Comments
Post a Comment