Skip site navigation (1) Skip section navigation (2)

Re: Conditional commit inside functions

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Gerhard Wiesinger" <lists(at)wiesinger(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Conditional commit inside functions
Date: 2008-12-25 12:58:13
Message-ID: 162867790812250458x7841b63fja7a5bbb5a8272c09@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
Hello,

PostgreSQL has doesn't use rollback segment, so commit over 10000
lines is not necessary, and it is bad.

Regards
Pavel Stehule

2008/12/25 Gerhard Wiesinger <lists(at)wiesinger(dot)com>:
> Hello!
>
> I want to translate the following Oracle PL/SQL script into plpgsql.
> Especially I'm having problems with the transaction thing. i tried START
> TRANSACTION and COMMIT without success.
>
> Any ideas?
>
> Thanx.
>
> Ciao,
> Gerhard
>
> CREATE OR REPLACE PROCEDURE insert_1Mio
> IS
>  maxcommit NUMBER;
> BEGIN
>  maxcommit := 10000;
>
>  FOR i IN 1..1000000 LOOP
>    INSERT INTO employee (id, department, firstname, lastname) VALUES (i, i,
> 'John' || to_char(i), 'Smith' || to_char(i));
>    IF MOD(i, maxcommit) = 0 THEN
>      COMMIT;
>    END IF;
>  END LOOP;
>
>  COMMIT;
> END;
>
>
>
> --
> http://www.wiesinger.com/
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

pgsql-general by date

Next:From: Grzegorz JaƛkiewiczDate: 2008-12-25 13:19:15
Subject: Re: lack of consequence with domains and types
Previous:From: Gerhard WiesingerDate: 2008-12-25 11:17:21
Subject: Conditional commit inside functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group