Representation of SubPlan testexpr in EXPLAIN - Mailing list pgsql-hackers

From Andrey Lepikhov
Subject Representation of SubPlan testexpr in EXPLAIN
Date
Msg-id de9a504e-0470-843d-72d6-3abc7517a448@postgrespro.ru
Whole thread Raw
List pgsql-hackers
Hi,

EXPLAIN command doesn't show testexpr. Sometimes it is not easy to 
understand a query plan. That I mean:

CREATE TABLE a (x integer, y integer);
EXPLAIN (COSTS OFF, VERBOSE) SELECT x, y FROM a upper
   WHERE y IN (SELECT y FROM a WHERE upper.y = x);
EXPLAIN (COSTS OFF, VERBOSE) SELECT x, y FROM a upper
   WHERE x+y IN (SELECT y FROM a WHERE upper.y = x);

These two explains have the same representation:
Seq Scan on public.a upper
    Output: upper.x, upper.y
    Filter: (SubPlan 1)
    SubPlan 1
      ->  Seq Scan on public.a
            Output: a.y
            Filter: (upper.y = a.x)

It is a bit annoying when you don't have original query or don't trust 
competence of a user who sent you this explain.
In attachment - patch which solves this problem. I'm not completely sure 
that this option really needed and patch presents a proof of concept only.

-- 
regards,
Andrey Lepikhov
Postgres Professional

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)
Next
From: "蔡梦娟(玊于)"
Date:
Subject: 回复:Queries that should be canceled will get stuck on secure_write function