Re: Damage control for planner's get_actual_variable_endpoint() runaway

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Jakub Wartak <jakub.wartak@enterprisedb.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Simon Riggs <simon.riggs@enterprisedb.com>, Robert Haas <robert.haas@enterprisedb.com>
Date: 2022-11-21T12:22:13Z
Lists: pgsql-hackers
On 2022-Nov-21, Jakub Wartak wrote:

> b) I was wondering about creating a new wait class "Planner" with the
> event "ReadingMinMaxIndex" (or similar). The obvious drawback is the
> naming/categorization as wait events are ... well.. as the name "WAIT"
> implies, while those btree lookups could easily be ON-CPU activity.

I think we should definitely do this, regardless of any other fixes we
add, so that this condition can be identified more easily.  I wonder if
we can backpatch it safely.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Always assume the user will do much worse than the stupidest thing
you can imagine."                                (Julien PUYDT)



Commits

  1. YA attempt at taming worst-case behavior of get_actual_variable_range.

  2. Improve performance of get_actual_variable_range with recently-dead tuples.

  3. Use SnapshotDirty rather than an active snapshot to probe index endpoints.