Re: 100% CPU at concurent access - Mailing list pgsql-sql

From Sabin Coanda
Subject Re: 100% CPU at concurent access
Date
Msg-id gcne3o$1l0t$1@news.hub.org
Whole thread Raw
In response to 100% CPU at concurent access  ("Sabin Coanda" <sabin.coanda@deuromedia.ro>)
List 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 




pgsql-sql by date:

Previous
From: "Bart Degryse"
Date:
Subject: Re: trigger parameters, what am I doing wrong ??
Next
From: Gerardo Herzig
Date:
Subject: replicating a table in several databases