From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: yunfeng.li.nb@gmail.com
Subject: BUG #18552: slow query, but using union is ok.
Date: Thu, 25 Jul 2024 09:53:58 +0000
Message-ID: <18552-c7180ffd32395469@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 18552
Logged by: Li Yunfeng
Email address: yunfeng.li.nb@gmail.com
PostgreSQL version: 16.3
Operating system: CENTOS 7
Description:
slow, waiting for a long time not return:
select a.c_mrid,a.c_pathname from sjzx_breaker a
where (exists(select * from sjzx_disconnector b,sjzx_transformerwinding
c
where c.c_powertransformer='117093590563292490' and
(b.c_i_node=c.c_i_node or b.c_j_node=c.c_i_node)
and (b.c_i_node=a.c_i_node or b.c_i_node=a.c_j_node or
b.c_j_node=a.c_i_node or b.c_j_node=a.c_j_node)))
or exists(select * from sjzx_transformerwinding f
where f.c_powertransformer='117093590563292490' and
(f.c_i_node=a.c_i_node or f.c_i_node=a.c_j_node))
but using union, it is ok:
select a.c_mrid,a.c_pathname from sjzx_breaker a
where (exists(select * from sjzx_disconnector b,sjzx_transformerwinding
c
where c.c_powertransformer='117093590563292490' and
(b.c_i_node=c.c_i_node or b.c_j_node=c.c_i_node)
and (b.c_i_node=a.c_i_node or b.c_i_node=a.c_j_node or
b.c_j_node=a.c_i_node or b.c_j_node=a.c_j_node)))
union
select e.c_mrid,e.c_pathname from sjzx_breaker e where exists(select * from
sjzx_transformerwinding f
where f.c_powertransformer='117093590563292490' and
(f.c_i_node=e.c_i_node or f.c_i_node=e.c_j_node))
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, yunfeng.li.nb@gmail.com
Subject: Re: BUG #18552: slow query, but using union is ok.
In-Reply-To: <18552-c7180ffd32395469@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox