Re: 100% CPU at concurent access

From: "Sabin Coanda" <sabin(dot)coanda(at)deuromedia(dot)ro>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: 100% CPU at concurent access
Date: 2008-10-10 11:25:55
Message-ID: gcne3o$1l0t$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I find the problem is in my outer procedure, because it has no sleep there,
and I change it calling pg_sleep:

-- Function: "TestProcOuter"()

-- DROP FUNCTION "TestProcOuter"();

CREATE OR REPLACE FUNCTION "TestProcOuter"()
RETURNS integer AS
$BODY$
DECLARE
Loops int4 := 1;
BEGIN
LOOP
RAISE NOTICE 'TestProcOuter: % loop', Loops;
IF 0 = "TestProcInner"() THEN
EXIT; -- LOOP
END IF;
Loops = Loops + 1;
PERFORM pg_sleep(4);
END LOOP;

RETURN 0;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "TestProcOuter"() OWNER TO postgres;

With this change, I found the first session succeeds, the CPU is not rised
anymore, but the second session doesn't succeed even after the first one
finish successfully.

It fails forever.

Why ? What have I make to succeed ?

TIA,
Sabin

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gerardo Herzig 2008-10-10 11:58:53 replicating a table in several databases
Previous Message Aarni Ruuhimäki 2008-10-10 10:56:11 SELECT multiple MAX(id)s ?