Check the restrictions of the database you're using. It could be you're exceeding some of it's limits. Several database systems limit how many concurrent locks you can set. Or limit the size/complexity of transactions. The limits could be hardcoded (nothing youc an do other than changing database engine). Or they could be restrictions you can change via some settings, increasing the lmits may increase memory consumption and degrade performance however, so again, check the documentation of your database.