Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: prepared transaction does not exist in postgresql

I am getting following error in PostgreSQL (9.2) log while running Java EE application with JPA over Hibernate:

ERROR: prepared transaction with identifier "131077_AAAAAAAAAAAAAP//fwAAAd5tKPBVp1XeAAAzfmx0Y2hpZS1ub2Rl_AAAAAAAAAAAAAP//fwAAAd5tKPBVp1XeAAAzpwAAAAAAAAAA" does not exist STATEMENT: ROLLBACK PREPARED '131077_AAAAAAAAAAAAAP//fwAAAd5tKPBVp1XeAAAzfmx0Y2hpZS1ub2Rl_AAAAAAAAAAAAAP//fwAAAd5tKPBVp1XeAAAzpwAAAAAAAAAA'

How can I optimize settings to avoid this error? This occurs intermittently.

like image 962
Valsaraj Viswanathan Avatar asked Jul 20 '15 05:07

Valsaraj Viswanathan


People also ask

What is prepared transaction in PostgreSQL?

PREPARE TRANSACTION is a PostgreSQLPostgreSQLPostgreSQL is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads.https://www.postgresql.org › aboutAbout - PostgreSQL extension. It is intended for use by external transaction management systems, some of which are covered by standards (such as X/Open XA), but the SQL side of those systems is not standardized.

What is Max_prepared_transactions?

max_prepared_transactions ( integer ) Sets the maximum number of transactions that can be in the “prepared” state simultaneously (see PREPARE TRANSACTION). Setting this parameter to zero (which is the default) disables the prepared-transaction feature. This parameter can only be set at server start.


1 Answers

The reason might be that prepared transactions are disabled by default. To enable them, edit postgresql.conf and set a value higher than 0.

max_prepared_transactions = 64
like image 135
Pierre Templier Avatar answered Sep 21 '22 11:09

Pierre Templier