From: | Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com> |
---|---|
To: | Tomas Vondra <tomas(at)vondra(dot)me>, Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Add support for (Var op Var) clause in extended MCV statistics |
Date: | 2024-08-12 15:57:19 |
Message-ID: | 8b5063a4-4642-4f9a-9533-1571fb33719a@tantorlabs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12.8.24 14:53, Tomas Vondra wrote:
> I agree, and I'm grateful someone picked up the original patch. I'll try
> to help to keep it moving forward. If the thread gets stuck, feel free
> to ping me to take a look.
Good. Thank you!
>> I started reviewing it and want to suggest some changes to better code:
>> I think we should consider the case where the expression is not neither
>> an OpExpr and VarOpVar expression.
>>
> Do you have some specific type of clauses in mind? Most of the extended
> statistics only really handles this type of clauses, so I'm not sure
> it's feasible to extend that - at least not in this patch.
I agree with Alena that we need to consider the following clauses: (Expr
op Var), (Var op Expr) and (Expr op Expr). And we need to return false
in these cases because we did it before my patch in
/* Check if the expression has the right shape */
if (!examine_opclause_args(expr->args, &clause_expr, NULL, NULL))
return false;
In is_opclause_var_op_var() function it is really useless local Node
*expr_left, *expr_right variables. However, we can't assign them NULL at
the begin because if I passed not-null pointers I have to return the
values. Otherwise remain them NULL.
Nevertheless, thank you for review, Alena.
>> Have you tested this code with any benchmarks?
>>
> FWIW I think we need to test two things - that it (a) improves the
> estimates and (b) does not have significant overhead.
Yes, but only TPC-B. And the performance did not drop. In general, it'd
be better to do more tests and those listed by Tomas with new attached
patch.
Attachment | Content-Type | Size |
---|---|---|
v2-Add-support-for-Var-op-Var-clause-in-extended-MCV-st.patch | text/x-patch | 48.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2024-08-12 16:25:34 | Re: Add support for (Var op Var) clause in extended MCV statistics |
Previous Message | Bertrand Drouvot | 2024-08-12 15:56:18 | Re: Restart pg_usleep when interrupted |