Re: App very unresponsive while performing simple update

From: Jan de Visser <jdevisser(at)digitalfairway(dot)com>
To: Brendan Duddridge <brendan(at)clickspace(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: App very unresponsive while performing simple update
Date: 2006-05-31 17:43:40
Message-ID: 200605311343.40925.jdevisser@digitalfairway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wednesday 31 May 2006 13:34, Brendan Duddridge wrote:
> Hi Jan,
>
> That sounds like a great idea! How would you control the update to
> occur only every 10,000 transactions?
>
> Is there a trigger setting for that somewhere?

I was thinking something like

IF count(*) % 10000 = 0 then
... do stuff ...
end if

Problem may be that that may be a bit expensive; maybe better to have a
sequence and use the sequence value.

Or something like that.

Also, maybe you should do the actual update of click_count not in the trigger
itself, but have the trigger do a NOTIFY and have another process do a
LISTEN. Depends how long the update takes.

jan

>
> Thanks,
>
> ____________________________________________________________________
> Brendan Duddridge | CTO | 403-277-5591 x24 | brendan(at)clickspace(dot)com
>
> ClickSpace Interactive Inc.
> Suite L100, 239 - 10th Ave. SE
> Calgary, AB T2G 0V9
>
> http://www.clickspace.com
>
> On May 31, 2006, at 6:34 AM, Jan de Visser wrote:
> > On Wednesday 31 May 2006 02:29, Brendan Duddridge wrote:
> >> We'll probably have to write a process to update the click_count from
> >> querying our product_click_history table.
> >
> > How about an insert trigger on product_click_history which updates
> > click_count
> > every say 10000 transactions or so?
> >
> > jan
> >
> > --
> > --------------------------------------------------------------
> > Jan de Visser jdevisser(at)digitalfairway(dot)com
> >
> > Baruk Khazad! Khazad ai-menu!
> > --------------------------------------------------------------
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 3: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/docs/faq

--
--------------------------------------------------------------
Jan de Visser                     jdevisser(at)digitalfairway(dot)com

                Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2006-06-01 03:18:05 Re: App very unresponsive while performing simple update
Previous Message Brendan Duddridge 2006-05-31 17:34:38 Re: App very unresponsive while performing simple update