Re: [PATCH] Add memory/disk usage for Function Scan nodes in EXPLAIN - Mailing list pgsql-hackers

From Yash Jadhav
Subject Re: [PATCH] Add memory/disk usage for Function Scan nodes in EXPLAIN
Date
Msg-id CAGsfjr5hzvqFc_N6cGve_wbE-T6kfN5MV6EipcPz1GdjUdD=cg@mail.gmail.com
Whole thread
In response to Re: [PATCH] Add memory/disk usage for Function Scan nodes in EXPLAIN  (Tatsuya Kawata <kawatatatsuya0913@gmail.com>)
Responses Re: [PATCH] Add memory/disk usage for Function Scan nodes in EXPLAIN
List pgsql-hackers
Hi, I have been studying this thread for the past few days now and
tried to understand the problem,

I was interested in investigating the part of swapping
tuplestore_end() for tuplestore_clear() for function scan.

> When a Function Scan is rescanned with changed parameters, the function
> is called again and the tuplestore is created anew.  With
> rsinfo.returnMode == SFRM_ValuePerCall it's created on the executor side
> by ExecMakeTableFunctionResult(), but with SFRM_Materialize it's created
> by the function itself, so the functions would be affected as well.
> Fixing the SFRM_Materialize case would be possible by allowing the
> tuplestore to be passed to the function and calling tuplestore_clear()
> on it, but that would change the SRF calling convention, which looks
> like a fairly large change, extensions included.

For now I understand that for each rerun, a new tuple store would be
obtained along with new stats, and that it would mean changing srf
calling convention in order for the swap to work, but that would mean
a big change. I have also tried to understand the relevant code path.

So I wanted to try if I could find a way to solve this, as a
first-time contributor, I'd appreciate any feedback on whether my
understanding is correct, and whether changing the calling convention
is the only way here.

Thank You. Regards,
Yash Jadhav



pgsql-hackers by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: 041_checkpoint_at_promote.pl might fail due to race condition on child kill
Next
From: Ilia Evdokimov
Date:
Subject: Memory leak in statext_ndistinct_build() during ANALYZE