python - Oracle 11g - query appears to cache even with NOCACHE hint -


i'm doing database benchmarking in python using cx_oracle module. benchmark results, i'm running 150 unique queries , timing execution of each one. i'm running this:

c = connection.cursor() starttime = time.time() c.execute('select /*+ nocache */ count (*) rowcount (' + sql + ')') endtime = time.time() runtime = endtime - starttime 

each query passed in through variable sql, , vary in length, runtime, , tables access. being said, queries exhibit following behavior:

1st run: slow (relatively)

2nd run: faster (takes anywhere 1/2 - 1/5 time)

3rd run: marginally faster 2nd run

all subsequent runs >= 4: approximately equal 3rd run

i need cache disabled accurate results, first few runs throwing off data; it's if nocache isn't working @ all... what's going on here?

edit: allan answered question, might interested, did little more research , came across these 2 pages helpful:

how clear cached items in oracle

http://www.dba-oracle.com/t_flush_buffer_cache.htm

from documentation:

the nocache hint specifies blocks retrieved table placed @ least used end of lru list in buffer cache when full table scan performed. normal behavior of blocks in buffer cache.

it seems nocache hint doesn't expect to.

you can clear shared cache running alter system flush shared_pool , buffer cache running alter system flush buffer_cache. you'll need between each query prevent cache being used.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -