Re: "Unify by values" setting in Oracle's base.py

2021-08-04 Thread NPB
Hi there - I think this question/idea is still relevant. I made these changes: https://github.com/nigelbayliss/django/commit/83b6b339ad58b0c1ac9283e49d7df9c9ea79b8d9 https://github.com/nigelbayliss/django/commit/7c3513cf97dc8ebee124cd3ddd154ca3d24d192c What's the right thing to do next? I don'

Re: "Unify by values" setting in Oracle's base.py

2021-04-27 Thread NPB
Hi there - Should I create a ticket? Thanks and regards, Nigel. On Wednesday, 14 April 2021 at 16:19:54 UTC+1 NPB wrote: > Hi - > > Here is something I tried out: > > https://github.com/nigelbayliss/django > > I am no Python expert, and having never done this before I'm not sure if > it would

Re: "Unify by values" setting in Oracle's base.py

2021-04-14 Thread NPB
Hi - Here is something I tried out: https://github.com/nigelbayliss/django I am no Python expert, and having never done this before I'm not sure if it would be worthy of a pull request. Let me know. I added a test to *compiler.py *to detect GROUP BYs with a combined expression. This test is

Re: "Unify by values" setting in Oracle's base.py

2021-04-13 Thread NPB
P.S. I think I will have a stab at creating a solution. I'll run it through the queries, aggregation, and aggregation_regress tests. Thanks, Nigel On Tuesday, 13 April 2021 at 13:34:30 UTC+1 NPB wrote: > Hi Mariusz and Simon, > > Yes, agreed, it is true that Oracle doesn't support column alias

Re: "Unify by values" setting in Oracle's base.py

2021-04-13 Thread NPB
Hi Mariusz and Simon, Yes, agreed, it is true that Oracle doesn't support column aliases in GROUP BY. It is possible to use "GROUP BY ", but only if a specific Oracle session parameter setting is used. IMO it would be undesirable to make this setting mandatory for Django, though. Oracle defini

Re: "Unify by values" setting in Oracle's base.py

2021-04-12 Thread Mariusz Felisiak
Hi Nigel, Creating a subquery only looks like a good solution for a limited number of cases. As far as I'm aware it will also change an execution plan and can cause a performance regression in complicated queries. We also cannot group by column aliases on Oracle as proposed in PR14251

Re: "Unify by values" setting in Oracle's base.py

2021-04-12 Thread charettes
Hello Nigel, > I wonder if it would be possible to catch cases where a bind variable would normally be included in both the SELECT list and the GROUP BY. It should be possible at the compiler level which is overriddable by backend (e.g. here's how it's done for a different purpose on MySQL back

Re: "Unify by values" setting in Oracle's base.py

2021-04-12 Thread NPB
Hi Simon, Thanks for tracking that down. I see - an interesting problem that lacks an obvious solution. Nevertheless, there is a generic way to deal with this and it will optimize OK in Oracle (at least in the vast majority of cases). select x, sum(sal) from (select :arg0 * deptno as x, sal f

Re: "Unify by values" setting in Oracle's base.py

2021-04-05 Thread charettes
Hello Nigel, Through git blame for unify_by_values I figured it was introduced[0] to deal with an issue during aggregation[1]. Mariusz might be able to provide more context here as I don't have much knowledge around Oracle cursor cache but it seems you'll have to find another way to address th

"Unify by values" setting in Oracle's base.py

2021-04-03 Thread NPB
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=