ERROR: canceling statement due to conflict with recovery
Error Details:
ERROR: canceling statement due to conflict with recovery
DETAIL: User query might have needed to see row versions that must be removed.
Business again
-
- system USES postgresql main library database architecture, main library used in WeChat small program mainly used in the business of writing data from library with the method of flow to copy from the main library update for library data, for the application of the library service is the background of query statistics web applications when the query statistics in the background, the SQL query is slower, table is updated data, and the query used to query for a long time will be following the above error </ ol>
-
- Question why
-
- Executive time on the main library query process, due to this query involves records may be updated, or deleted in the main library, according to the PostgreSQL MVCC mechanism, update, or delete data is not immediately deleted from the physical block, but after autovacuum process VACUUM data of the old version, the main library to update, or delete data on the old version, after VACUUM from the library will also carry out the operation, thus conflict with from the current query library, cause the query to interrupt and throw more mistakes.
-
- The solution
-
- On a business level
-
- From the business can optimize the slow SQL, whether the data table is too large, whether need to separate the database table, frequently update the frequent table analysis and vacuum and so on. Or segmenting query, avoid peak period data update time, etc
-
- From the database level
-
- Modify the maxSTANDBY_ STREAMING_DELAY parameter
-
- This parameter for 30 seconds, by default when executing SQL for library, may have clashed with is application of a WAL, this query if there is no execution is suspended for 30 seconds, 30 seconds note not for library individual queries allow maximum execution time, refers to allow maximum when case library application on a WAL WAL delay time, so for library query execution time may be less than the value of this setting has been suspended, this parameter can be set to 1, said from the library when WAL application process and executed queries from the library, a WAL application process waits until from the database query execution. (When I was processing, I set a larger value of 120, although occasionally an error will be reported, but the frequency of error will be much less, it is suggested that this exception can be caught in background processing, and the query user will be reminded that the query is currently busy, please try again later)
-
- Modify the hotstandby_feedback parameter
-
- By default when performing a query from the library will not notify the main library, set this parameter to on after from library to execute queries will notify the main library, when from library query execution process, the main library won’t clean up the data from library need old version, therefore, the query from the library will not be suspended, however, this method also can bring certain disadvantages, table may appear on the main library expansion, the expansion of the main library table level and on the table write transactions and execution time from the library, this parameter is off by default. (This approach is risky, I haven’t tested it)
- After modifying the parameter configuration, you need to reload the database configuration file
Read More:
- [Solved] ERROR OGG-01028 Detect partial pdata at rba xxxxxx without coinciding crash recovery marker record
- [Solved] CONDA error: The following specifications were found to be in conflict
- Hive Statement Error During Execution: Error while processing statement: FAILED: Execution Error, return code 2 from o
- [Cadence Allegro PCB Design] error: Possible pin type conflict GND/VCC Power Connected to Output
- How to Fix Error 1069:The service did not start due to a logon failure
- [Solved] UNABLE TO START SERVLETWEBSERVERAPPLICATIONCONTEXT DUE TO MISSING SERVLETWEBSERVERFACTORY BEAN
- [Solved] ClientError.Security.Unauthorized: The client is unauthorized due to authentication failure.
- [Solved] Unity Import Xcode Project Error: iOS framework addition failed due to a CocoaPods installation failure.
- [Solved] Kubeadm Reset error: etcdserver: re-configuration failed due to not enough started members
- How to Solve Hmaster hangs up issue due to namenode switching in Ha mode
- Hive 3.1.2 startup error reporting and resolution of guava version conflict
- [Solved] push declined due to email privacy restrictions (GH007 error code)
- How to Solve linq Statement IsNullOrWhiteSpace Error
- XAMPP Error: Apache shutdown unexpectedly.This may be due to a blocked port, missing dependencies…
- Template cannot be rendered due to the joint query of populate in mongoose: syntax error: unexpected token r in JSON at position 0
- [Solved] Installation failed due to: ‘INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: Package com.
- ORA-24338 statement handle not executed [How to Solve]
- [Solved] Hive tez due to: ROOT_INPUT_INIT_FAILURE java.lang.IllegalArgumentException: Illegal Capacity: -38297
- Log jar package conflict error: Class path contains multiple SLF4J bindings
- [Solved] A needed class was not found. This could be due to an error in your runpath. Missing class: scala/co