pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18552: slow query, but using union is ok.
2+ messages / 2 participants
[nested] [flat]

* BUG #18552: slow query, but using union is ok.
@ 2024-07-25 09:53  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2024-07-25 09:53 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: yunfeng.li.nb@gmail.com

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))



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #18552: slow query, but using union is ok.
@ 2024-07-25 12:06  David Rowley <dgrowleyml@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: David Rowley @ 2024-07-25 12:06 UTC (permalink / raw)
  To: yunfeng.li.nb@gmail.com; pgsql-bugs@lists.postgresql.org

On Fri, 26 Jul 2024 at 00:01, PG Bug reporting form
<noreply@postgresql.org> wrote:
> slow, waiting for a long time not return:

This is the wrong place to discuss slow queries. This mailing list is
for bug reports. Please read [1] for instructions on how to get help
with your slow query.

David

[1] https://wiki.postgresql.org/wiki/Slow_Query_Questions





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-07-25 12:06 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-25 09:53 BUG #18552: slow query, but using union is ok. PG Bug reporting form <noreply@postgresql.org>
2024-07-25 12:06 ` David Rowley <dgrowleyml@gmail.com>

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