Le 07/07/2021 à 18:55, Gilles Darold a écrit :
Le 07/07/2021 à 18:50, Gilles Darold a écrit :

Great, I changing the state in the commitfest to "Ready for committers".


I'm attaching the v5 patch again as it doesn't appears in the Latest attachment list in the commitfest.


And the review summary:


This patch allows pushing CASE expressions to foreign servers, so that:

  - more types of updates could be executed directly
  - full foreign table scan can be avoid
  - more push down of aggregates function

The patch compile and regressions tests with assert enabled passed successfully.
There is a compiler warning but it is not related to this patch:

        deparse.c: In function ‘foreign_expr_walker.isra.0’:
        deparse.c:891:28: warning: ‘collation’ may be used uninitialized in this function [-Wmaybe-uninitialized]
          891 |       outer_cxt->collation = collation;
              |       ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
        deparse.c:874:10: warning: ‘state’ may be used uninitialized in this function [-Wmaybe-uninitialized]
          874 |  else if (state == outer_cxt->state)
              |          ^

The regression test for this feature contains the use cases where push down of CASE clause are useful.
Nested CASE are also part of the regression tests.

The patch adds insignificant overhead by processing further than before a case expression but overall it adds a major performance improvement for queries on foreign tables that use a CASE WHEN clause in a predicate or in an aggregate function.


This patch does what it claims to do without detect problem, as expected the CASE clause is not pushed when a local table is involved in the CASE expression of if a non default collation is used.

Ready for committers.



Reply via email to