Change tuplestore_get_stats() API Previously, this returned a pointer to the string constant "Disk" or "Memory" depending on whether the tuplestore spilled to disk or not. An upcoming patch adds additional EXPLAIN ANALYZE output for Material nodes for parallel workers. The API pointing to the string constant is not great when we must transfer the storage method to the parallel leader, as we cannot simply point to the string constant in the other process. That's going to be mapped to a different memory address.
Here we adjust the tuplestore_get_stats() API to set "*used_disk" to true when the tuplestore spilled to disk. This allows us to avoid a pretty horrible: if (strcmp(..., "Disk") == 0) in the code to transfer the information to the parallel leader. Author: David Rowley <[email protected]> Reviewed-by: Tatsuya Kawata <[email protected]> Reviewed-by: Chao Li <[email protected]> Discussion: https://postgr.es/m/caaphdvouwcms-b27mpdkd5_ruftanvrxpgn9u3qoqbbihk+...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/c6b8af429b3592b00d3240a24c5a27077ff0dd82 Modified Files -------------- src/backend/commands/explain.c | 45 +++++++++++++++++++------------------ src/backend/utils/sort/tuplestore.c | 9 ++------ src/include/utils/tuplestore.h | 2 +- 3 files changed, 26 insertions(+), 30 deletions(-)
