SELECT on view runs slower with more WHERE conditions

From: aditya desai <admad123(at)gmail(dot)com>
To: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: SELECT on view runs slower with more WHERE conditions
Date: 2021-11-16 17:10:08
Message-ID: CAN0SRDE8UgmDVd1CT40wR_m3tx0xqWHnQ74NYnFZA4d1S=Ob0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,
I have a view on which we are running query with below conditions.

select * from view_alerts
where
datetypeid=2 and
timeperiodid=2 and
alertreasonid= 2 and
(percendate < -25 or percentage > 25 )

Whenever I run query with only one WHERE condition it runs within 1 min. If
I keep more than one WHERE condition in above query it hangs. Also just
select * from view_alerts runs in just 1 min. Unfortunately I am unable to
put explain plan.

Any suggestions here?

Regards,
Aditya.

Browse pgsql-sql by date

  From Date Subject
Next Message Shaozhong SHI 2021-11-30 00:17:54 Re: Fault with initcap
Previous Message chris 2021-11-11 14:23:57 Re: Constructing colum name as alias