Python 2: unicode vs str param causing slowness
Dayton Gomez <Dayton_Gomez-okLH5SSHHyRWk0Htik3J/[email protected]> Tue, 20 Jan 2015 07:55:46 -0800
| Newsgroups | gmane.comp.python.db.cx-oracle |
|---|---|
| Message-ID | <D0E3C892.39398%[email protected]> |
This very well could be the oracle server, but I figure I could ask here. Perhaps someone has run into this and could guide me in a better direction.
I have a table, let's call it "device", that has lots of rows. It has a column, "platform", that's NVARCHAR2(20) and has an index on it. In python, when I execute a query on the data using a unicode object as a parameter, the whole query slows down from .1 seconds to over 100 seconds.
100 seconds:
cursor.execute('''SELECT COUNT(*) FROM "device" WHERE "PLATFORM" = :platform''', {'platform': u'ios'})
.1 seconds:
cursor.execute('''SELECT COUNT(*) FROM "device" WHERE "PLATFORM" = :platform''', {'platform': 'ios'})
Another interesting fact is that the slowness happens on 11g, but not oracle 12c. 12c seems to operate just fine with either. Both have:
NLS_CHARACTERSET WE8MSWIN1252
NLS_NCHAR_CHARACTERSET AL16UTF16
I'm using django as a layer of abstraction above cx_Oracle, and django seems to make everything unicode before the query is sent. So string conversion beforehand is likely not an option.
Is there some⦠oracle-side setting I'm missing? Or maybe some encoding/decoding setting in cx_Oracle?
Thanks much!
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
cx-oracle-users mailing list
cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/cx-oracle-users