• Etsuro Fujita's avatar
    Fix EXPLAIN ANALYZE for async-capable nodes. · a363bc6d
    Etsuro Fujita authored
    EXPLAIN ANALYZE for an async-capable ForeignScan node associated with
    postgres_fdw is done just by using instrumentation for ExecProcNode()
    called from the node's callbacks, causing the following problems:
    
    1) If the remote table to scan is empty, the node is incorrectly
       considered as "never executed" by the command even if the node is
       executed, as ExecProcNode() isn't called from the node's callbacks at
       all in that case.
    2) The command fails to collect timings for things other than
       ExecProcNode() done in the node, such as creating a cursor for the
       node's remote query.
    
    To fix these problems, add instrumentation for async-capable nodes, and
    modify postgres_fdw accordingly.
    
    My oversight in commit 27e1f145.
    
    While at it, update a comment for the AsyncRequest struct in execnodes.h
    and the documentation for the ForeignAsyncRequest API in fdwhandler.sgml
    to match the code in ExecAsyncAppendResponse() in nodeAppend.c, and fix
    typos in comments in nodeAppend.c.
    
    Per report from Andrey Lepikhov, though I didn't use his patch.
    
    Reviewed-by: Andrey Lepikhov
    Discussion: https://postgr.es/m/2eb662bb-105d-fc20-7412-2f027cc3ca72%40postgrespro.ru
    a363bc6d
pg_stat_statements.c 80.3 KB