BUG #18694: DISCARD ALL does not reset execution counters for plpgsql functions - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18694: DISCARD ALL does not reset execution counters for plpgsql functions
Date
Msg-id 18694-7b7b34afc52db448@postgresql.org
Whole thread Raw
Responses Re: BUG #18694: DISCARD ALL does not reset execution counters for plpgsql functions
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18694
Logged by:          David Pavlíček
Email address:      pavlicek.david@gmail.com
PostgreSQL version: 13.13
Operating system:   Linux
Description:

Recently, I encountered a issue where execution plans for SQL queries within
plpgsql functions differed significantly in a pooled database session, even
though after each call the session state was cleared using the DISCARD ALL
command. As per documentation, DISCARD ALL resets the session to its initial
state, which is probably not true for plpgsql exec counters. When
considering that execution plans for internal queries is generated based on
number of execution within single session (custom vs generic), this can have
huge impact on how the functions behaves in combination with connection
pooler, whether central one like pgbouncer or those built into client
libraries. In my opinion, the DISCARD ALL command should reset the internal
execution counters of plpgsql functions.


pgsql-bugs by date:

Previous
From: Aleksander Alekseev
Date:
Subject: TimestampTz->Text->TimestampTz casting fails with DateStyle 'Postgres'
Next
From: PG Bug reporting form
Date:
Subject: BUG #18696: Compatibility Query for Updating zlib1.dll in PostgreSQL 10.2 to Address Security Vulnerabilities