Search Postgresql Archives

Re: Conditional commit inside functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>:
> 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@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux