We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

General try and catch for PDO

We are doing some data warehouse stuff based on Phalcon. So there are high concurrent processes writing into MySQL. Sometimes, at different points of code, a deadlock occurs. So my question is, if it's possible to create a general middleware/listener for ORM/PDO to re-try the executed statements and fail not until 3 retries?


can you explain more on the meanning of deadlock

do you mean the mysql ( assuming here ) server has a sudden crash ?

Data warehousing takes lots of queries and needs lots of throughput. ORM & PDO might not be the best choice for this as they both add some overhead. In a typical application that overhead is worth the abstraction the layers provide. For data warehousing though, you might just want to write the queries in raw SQL for your DB of choice (MySQR) and don't even use the ORM or PDO.