BUG #4382: there is an exagerate increase of execution times putting a 'case' condition in this update

From: "Gianluca Buttarelli" <gianluca(dot)buttarelli(at)business-partner(dot)it>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4382: there is an exagerate increase of execution times putting a 'case' condition in this update
Date: 2008-08-27 13:00:02
Message-ID: 200808271300.m7RD02jp088480@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4382
Logged by: Gianluca Buttarelli
Email address: gianluca(dot)buttarelli(at)business-partner(dot)it
PostgreSQL version: 8.1.11
Operating system: linux
Description: there is an exagerate increase of execution times
putting a 'case' condition in this update
Details:

update accounts_changing set closed_sc_nowcurrent_nbr = (select count (*)
from crm_shopping_carts ,qab_wf_states
where accounts_changing.account_id=crm_shopping_carts.agency_id
and qab_wf_states.state_code in ('SC-FAT1','SC-FAT2') and
crm_shopping_carts.state_id = qab_wf_states.state_id and
(case when ( CURRENT_DATE > date(EXTRACT(YEAR FROM
CURRENT_DATE)||'-10-31') and CURRENT_DATE < date(EXTRACT(YEAR FROM
CURRENT_DATE)||'-12-31'))
then (crm_shopping_carts.creation_date between date((EXTRACT(YEAR FROM
CURRENT_DATE))||'-11-01') and CURRENT_DATE)
else (crm_shopping_carts.creation_date between date((EXTRACT(YEAR FROM
CURRENT_DATE)-1)||'-11-01')and CURRENT_DATE) end ))
where active_indcr='1'

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Wright 2008-08-27 13:15:03 Re: BUG #4381: Postgresql daemon won't stay in the foreground
Previous Message Heikki Linnakangas 2008-08-27 12:54:55 Re: BUG #4381: Postgresql daemon won't stay in the foreground