From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kevin Grittner <kgrittn(at)ymail(dot)com> |
Cc: | Antonin Houska <antonin(dot)houska(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Reference to parent query from ANY sublink |
Date: | 2013-12-12 15:12:37 |
Message-ID: | 3838.1386861157@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Kevin Grittner <kgrittn(at)ymail(dot)com> writes:
> Further confirmation using the EXPLAIN patch with Antonin's v2
> patch against the table before any EXPLAIN or ANALYZE:
> Hash Join (cost=37.12..80.40 rows=442 width=12)
> Hash Cond: (((upper.f2)::double precision = lower.f3) AND (upper.f1 = lower.f2))
> -> Seq Scan on subselect_tbl upper (cost=0.00..27.70 rows=1770 width=16)
> -> Hash (cost=34.12..34.12 rows=200 width=12)
> -> HashAggregate (cost=32.12..34.12 rows=200 width=12)
> Group Key: lower.f2
> -> Seq Scan on subselect_tbl lower (cost=0.00..27.70 rows=1770 width=12)
That's about what I thought: it's unique-ifying according to the original
semijoin qual, without realizing that the pulled-up clause from the lower
WHERE would need to be treated as part of the semijoin qual. This isn't
a bug in the existing code, because the case can never arise, since we
don't treat an IN/=ANY as a semijoin if the sub-select contains any
outer-level Vars. But if you remove that check from
convert_ANY_sublink_to_join then you've got to deal with the problem.
That said, I'm not too sure where the problem is in detail. I'd have
thought that subquery pullup would stick the subquery's WHERE clause
into the join quals of the parent JoinExpr node. Is that not happening,
or is it perhaps not sufficient to cue the UniquePath machinery?
> The additional information is so useful, I'm all for committing
> that patch.
Will do.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2013-12-12 15:19:03 | Re: Time-Delayed Standbys |
Previous Message | Robert Haas | 2013-12-12 15:07:56 | Re: should we add a XLogRecPtr/LSN SQL type? |