Equivalent of or condition in where clause

From: Firthouse banu <penguinsfairy(at)gmail(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Equivalent of or condition in where clause
Date: 2021-04-01 08:41:12
Message-ID: CAK_Ha4xs9Riv5OyDSyYGTY=nO5EKiACGnbm4hm8wScwxppbgjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi all,

Need a suggestion. I have a update query in Postgres which is equivalent to
below example. Since query is having multiple or conditions and our tables
are very large it’s taking forever to run. Can you guys suggest me what can
be replaced with or condition in below example.

Update table_name IA set
Column_1 = SC. Column_1,
Column_2 = SC. Column_2,
Column_3 = SC. Column_3
From (select statement ) SC
Where
IA. Column4=! SC. Column4 or
IA.column5 = ! SC. Column5 or
IA.column6 = ! SC. Column6 or
IA.column7 = ! SC. Column7
And IA. Column8 = SC. Column8
And IA. Column9 = SC. Column9;

Thanks

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Julien Rouhaud 2021-04-01 09:02:44 Re: Equivalent of or condition in where clause
Previous Message Sachin Kumar 2021-04-01 07:43:38 Re: work_mem