Hi, Can you tell me why *execute* in .../backends/oracle/base.py sets *unify_by_values=True* when it calls *_fix_for_params*? It has an interesting effect on the Oracle cursor cache.
For example, if I use a Django model called Logger like this: from . import models ... a = models.Logger(t1="1", t2="2", t3="3", i1=1, i2=2, i3=3) a.save() b = models.Logger(t3="3", t2="2", t1="1", i3=3, i2=2, i1=1) b.save() c = models.Logger(t1="1", t2="2", t3="3", i1=1,i2=1,i3=3) c.save() d = models.Logger(t1="1", t2="2", t3="3", i1=3,i2=1,i3=3) d.save() e = models.Logger(t1="1", t2="1", t3="1", i1=1,i2=1,i3=1) e.save() It results in the following SQL statements in the Oracle cursor cache: INSERT INTO "POLLS_LOGGER" ("T1", "T2", "T3", "I1", "I2", "I3") VALUES (:arg0, :arg1, :arg2, :arg3, :arg4, :arg3) RETURNING "POLLS_LOGGER"."ID" INTO :arg5 INSERT INTO "POLLS_LOGGER" ("T1", "T2", "T3", "I1", "I2", "I3") VALUES (:arg0, :arg0, :arg0, :arg1, :arg1, :arg1) RETURNING "POLLS_LOGGER"."ID" INTO :arg2 INSERT INTO "POLLS_LOGGER" ("T1", "T2", "T3", "I1", "I2", "I3") VALUES (:arg0, :arg1, :arg2, :arg3, :arg4, :arg5) RETURNING "POLLS_LOGGER"."ID" INTO :arg6 INSERT INTO "POLLS_LOGGER" ("T1", "T2", "T3", "I1", "I2", "I3") VALUES (:arg0, :arg1, :arg2, :arg3, :arg3, :arg4) RETURNING "POLLS_LOGGER"."ID" INTO :arg5 Bind variable names are re-used and shuffled around if any share the same value. This results in multiple SQL IDs. If, instead, execute used *unify_by_values=False*, then the Oracle buffer cache would have a single version of the statement irrespective of bind values: INSERT INTO "POLLS_LOGGER" ("T1", "T2", "T3", "I1", "I2", "I3") VALUES (:arg0, :arg1, :arg2, :arg3, :arg4, :arg5) RETURNING "POLLS_LOGGER"."ID" INTO :arg6 On the face of it, the use of unify_by_values=False is more efficient (at least from the database's perspective) because there is only one hard parse. I guess it doesn't look like a big deal in this example, but I have seen cases where the cursor cache has (literally) tens of thousands of repeated cursor cache entries where one would have been used if bind names were kept consistent and independent of bind value. Do you think there is a valid case for this default behavior to be changed? Regards, Nigel -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/8a700747-e953-4018-aec8-d60007961407n%40googlegroups.com.