Re: [cx-oracle-users] prepare not needed before execute many, right?
Brought to you by:
atuining
From: Amaury F. d'A. <ama...@gm...> - 2007-01-18 09:09:10
|
2007/1/18, Mark Harrison <mh...@pi...>: > Is there a difference between calling: > > curs.prepare("call set_x1(:a,:b)") > curs.executemany("call set_x1(:a,:b)", mylist) > > and just: > > curs.executemany("call set_x1(:a,:b)", mylist) > > I know it doesn't make sense, but my test program > seems to be faster with the prepare. I'm sure it's > other factors, but I just want to make sure I'm > not being stupid. > I checked with the cx_Oracle source code, and you seem to be right: at the C level, there is no difference between the two cases. Moreover, the additional function call should make the first sample a little slower. BTW, when the statement is prepared, it's better to call executemany with None instead of repeating the query: cursor.executemany(None, mylist) cx_Oracle compare queries by string identity ('is', not '=='). Here the compiler optimizes the script by sharing the same string for the two lines. So it should not have any performance impact in this case. -- Amaury Forgeot d'Arc |