Re: Python 2: unicode vs str param causing slowness

Doug Henderson <[email protected]> Tue, 20 Jan 2015 10:39:38 -0700
Newsgroups gmane.comp.python.db.cx-oracle
Message-ID <CAJ1FpuPU-W8GsF2L1SWx=W+xwL8cAeyc1VRTt1R0xFvqy8-QDg@mail.gmail.com>
On 20 January 2015 at 08:55, Dayton Gomez <Dayton_Gomez-okLH5SSHHyRWk0Htik3J/[email protected]> wrote:
>
> 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'})

This sounds similar to problems where the indexed column is implicitly
type converted to match the bind variable's type.

To test this, in 11g, if possible, rewrite the query as:

cursor.execute('''SELECT COUNT(*) FROM "device" WHERE :platform =
"PLATFORM"''', {'platform': u'ios'})

Doug

-- 
Doug Henderson, Calgary, Alberta, Canada

------------------------------------------------------------------------------
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