From: | Feike Steenbergen <feikesteenbergen(at)gmail(dot)com> |
---|---|
To: | digoal(at)126(dot)com |
Cc: | PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #14746: sub query's plan not right? |
Date: | 2017-07-26 08:58:59 |
Message-ID: | CAK_s-G1uKcq84DHKPJ11+N3xfVX9qS9=4McF8UtM+Ox0rF9qVg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> is this a bug ? or it can be improved?
Perhaps, for me it rings a bell of using OFFSET 0 as a hack, that at least
has
the property of not changing the logic of your query:
select (t.b).aid,(t.b).val,(t.b).crt_time
from
(
select
(
select b from b
where b.aid=a.id
order by crt_time desc limit 1
)
from a offset 0
) t
where (t.b).aid is not null;
Previous similar discussion:
https://www.postgresql.org/message-id/E1RfAwz-0006Us-7B%40wrigleys.postgresql.org
Some other pointers:
https://blog.2ndquadrant.com/postgresql-ctes-are-optimization-fences/
https://stackoverflow.com/questions/14897816/how-can-i-prevent-postgres-from-inlining-a-subquery
From | Date | Subject | |
---|---|---|---|
Next Message | Rick Otten | 2017-07-26 14:47:26 | signal 11 segfaults with parallel workers |
Previous Message | Amit Langote | 2017-07-26 06:29:41 | Re: [BUGS] BUG #14759: insert into foreign data partitions fail |