Re: SLEEP in posgresql

From: "Jasbinder Singh Bali" <jsbali(at)gmail(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: "Michal Taborsky - Internet Mall" <michal(dot)taborsky(at)mall(dot)cz>, pgsql-general(at)postgresql(dot)org
Subject: Re: SLEEP in posgresql
Date: 2007-10-10 09:06:33
Message-ID: a47902760710100206h57fd858dh3bf900d7eac87860@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I don't know how is a sleep of 1 second going to be harmful here instead of
keeping a busy wait.

Even if a=b is going to take 1 week as u say, isn't a sleep of 1 second, if
nothing, would save some CPU resources instead of blindly looping for ever ?
Aren't busy waits dangerous from CPU resources point of view ? Won't it keep
my CPU busy for ever. Also, if there's a sleep of 1 second, is it going to
give me some saving in CPU resources or not ?

On 10/10/07, Richard Huxton <dev(at)archonet(dot)com> wrote:
>
> Jasbinder Singh Bali wrote:
> > my loop is a busy wait and keeps iterating until a=b condition is met.
> > However, it would lead to millions of instructions executing per second.
> >
> > So to save resources, I want to keep a sleep before re-iterating. Don't
> > understand how is SLEEP disastrous here even if i don't know when is my
> loop
> > going to end
>
> What if it takes a week?
>
> That means you'll have a transaction open for a week blocking vacuum
> from reclaiming space.
>
> --
> Richard Huxton
> Archonet Ltd
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message vladimir konrad 2007-10-10 09:07:10 corrupt database?
Previous Message Jasbinder Singh Bali 2007-10-10 09:05:32 Re: SLEEP in posgresql