Re: Query with correlated join having slow performance

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: saket bansal <saket(dot)tcs(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Query with correlated join having slow performance
Date: 2019-12-09 18:48:47
Message-ID: CAHOFxGqm3PwX2M7k4BPNmX5pVii9tbA=uyLP+Xuhooc_+ZZ36A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'd suggest re-writing your query to avoid ORs whenever possible. Is this
generated by an ORM or subject to change with filters selected in
application or can you totally control it on DB side?

It may be hugely more performant to simply rewrite this as (almost) the
same query twice UNION ALL'd together to separate the
productalt1_.alt_pdt_dbky OR productalt1_.orgnl_pdt_dbky conditions.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Justin 2019-12-09 19:43:25 Re: Query with correlated join having slow performance
Previous Message saket bansal 2019-12-09 18:22:51 Query with correlated join having slow performance