Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the differences between Oracle and PostgreSQL in transaction processing

Shulou Source: shulou.com Published: 2022-05-31 14:38:51 11月08日 Update

This article focuses on "what are the differences between Oracle and PostgreSQL in transaction processing". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the differences between Oracle and PostgreSQL in transaction processing?"

Oracle

Oracle database, multiple statements in the same transaction, such as a statement execution error, the statement does not affect the execution of other statements, such as transaction commit, the execution of successful statements will be persisted to DB.

Test script:

TEST-orcl@server4 > drop table tbl3;Table dropped.TEST-orcl@server4 > create table tbl3 (var varchar (2), fixed char (2)); Table created.TEST-orcl@server4 > TEST-orcl@server4 > insert into tbl3 values ('1Chou Zuo 1'); 1 row created.TEST-orcl@server4 > insert into tbl3 values (' 2Zhi Zhi Jian 2'); 1 row created.TEST-orcl@server4 > insert into tbl3 values ('test x3Jing' Test x3') Insert into tbl3 values ('test x3') * ERROR at line 1:ORA-12899: value too large for column "TEST". "TBL3". "VAR" (actual: 6, maximum:2) TEST-orcl@server4 > insert into tbl3 values ('4Xu dagger 4'); 1 row created.TEST-orcl@server4 > TEST-orcl@server4 > commit;Commit complete.TEST-orcl@server4 > TEST-orcl@server4 > select * from tbl3;VA FI-- 1 1224 4TEST-orcl@server4 >

PG

PG database, multiple statements in the same transaction, such as an error in the execution of a SQL statement, the transaction will be rolled back even if the commit is executed later. If you execute other DML statements after the error statement, an error will be reported.

Testdb=# drop table if exists tbl3; tbl3;DROP TABLEtestdb=# create table tbl3 (var varchar (2), fixed char (2)); CREATE TABLEtestdb=# testdb=# begin;BEGINtestdb=# testdb=# insert into tbl3 values ('1m); INSERT 0 1testdb=# insert into tbl3 values ('2m); INSERT 0 1testdb=# insert into tbl3 values ('test 3'); ERROR: value too long for type character varying (2) testdb=# insert into tbl3 values ('4m) ERROR: current transaction is aborted, commands ignored until end of transaction blocktestdb=# testdb=# commit;ROLLBACKtestdb=# testdb=# select * from tbl3; var | fixed-+-(0 rows) so far, I believe you have a better understanding of "what are the differences between Oracle and PostgreSQL in transaction processing". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Statement transaction test processing content multiple data database learning practical deeper successful interested practical practical easy to operate method more friends website Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Linux MariaDB Docker Microsoft