Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

It would be great if Craft CMS supports ProxySQL to increase performance.

ProxySQL is a high-performance SQL proxy that sits between applications and databases (MySQL, MariaDB, PostgreSQL), providing features like connection pooling, load balancing, query routing, and high availability without changing application code. More information is available at www.proxysql.com.

In our tests, ProxySQL seems to work fine for frontend requests, but at /admin we get internal server errors:

  • /admin/actions/entries/create: Duplicate entry '1234' for key 'PRIMARY' at entries_meta
  • /admin/entries/pages/1234: There is already an active transaction

ProxySQL-Configuration (query-part)

mysql_query_rules:
(
       {
               rule_id=1
               active=1
               match_pattern="^SELECT .*"
               destination_hostgroup=0
               apply=1
               cache_ttl=30000

       },
       {
               rule_id=2
               active=1
               match_pattern="^SHOW .*"
               destination_hostgroup=0
               apply=1
               cache_ttl=3600000

       }
)

Errors in CMS-backend

  • POST /admin/actions/entries/create
[web.ERROR] [yii\db\IntegrityException] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '10585849' for key 'PRIMARY' The SQL being executed was:
INSERT INTO `entries_meta` (`id`, `archiveDate`, `mainCategoryId`, `parentEntryId`, `internalTitle`, `internalNotes`, `dateCreated`, `dateUpdated`) VALUES (10585849, NULL, NULL, NULL, NULL, NULL, '2026-07-09 08:28:29', '2026-07-09 08:28:29') {"trace":[
"#0 vendor/yiisoft/yii2/db/Command.php(1325): yii\\db\\Schema->convertException()",
"#1 vendor/yiisoft/yii2/db/Command.php(1120): yii\\db\\Command->internalExecute()",
"#2 vendor/yiisoft/yii2/db/Schema.php(431): yii\\db\\Command->execute()",
"#3 vendor/yiisoft/yii2/db/ActiveRecord.php(604): yii\\db\\Schema->insert()",
"#4 vendor/yiisoft/yii2/db/ActiveRecord.php(570): yii\\db\\ActiveRecord->insertInternal()",
"#5 vendor/yiisoft/yii2/db/BaseActiveRecord.php(688): yii\\db\\ActiveRecord->insert()",
"#6 src/module/EventHandler/EntryMetaEventHandler.php(548):yii\\db\\BaseActiveRecord->save()",
"#7  [internal function]: Own\\Website\\EventHandler\\EntryMetaEventHandler->onAfterSave()",
"#8 vendor/yiisoft/yii2/base/Event.php(312): call_user_func()",
"#9 vendor/yiisoft/yii2/base/Component.php(654): yii\\base\\Event::trigger()",
"#10 vendor/craftcms/cms/src/base/Element.php(6424): yii\\base\\Component->trigger()",
"#11 vendor/craftcms/cms/src/elements/Entry.php(2919): craft\\base\\Element->afterSave()",
"#12 vendor/craftcms/cms/src/services/Elements.php(3978): craft\\elements\\Entry->afterSave()",
"#13 vendor/craftcms/cms/src/services/Elements.php(1251): craft\\services\\Elements->{closure:craft\\services\\Elements::_saveElementInternal():3760}()",
"#14 vendor/craftcms/cms/src/services/Elements.php(3760): craft\\services\\Elements->ensureBulkOp()",
"#15 vendor/craftcms/cms/src/services/Elements.php(4321): craft\\services\\Elements->_saveElementInternal()",
"#16 vendor/craftcms/cms/src/services/Elements.php(4002): craft\\services\\Elements->_propagateElement()",
"#17 vendor/craftcms/cms/src/services/Elements.php(1251): craft\\services\\Elements->{closure:craft\\services\\Elements::_saveElementInternal():3760}()",
"#18 vendor/craftcms/cms/src/services/Elements.php(3760): craft\\services\\Elements->ensureBulkOp()",
"#19 vendor/craftcms/cms/src/services/Elements.php(1337): craft\\services\\Elements->_saveElementInternal()",
"#20 vendor/craftcms/cms/src/services/Drafts.php(261): craft\\services\\Elements->saveElement()",
"#21 vendor/craftcms/cms/src/controllers/EntriesController.php(185): craft\\services\\Drafts->saveElementAsDraft()",
"#22 [internal function]: craft\\controllers\\EntriesController->actionCreate()",
"#23 vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()",
"#24 vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()",
"#25 vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction()",
"#26 vendor/craftcms/cms/src/web/Application.php(360): yii\\base\\Module->runAction()",
"#27 vendor/craftcms/cms/src/web/Application.php(659): craft\\web\\Application->runAction()",
"#28 vendor/craftcms/cms/src/web/Application.php(322): craft\\web\\Application->_processActionRequest()",
"#29 vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest()",
"#30 web/index.php(16): yii\\base\\Application->run()",
"#31 {main}"],"memory":34612256,
"exception":"[object] (yii\\db\\IntegrityException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '10585849' for key 'PRIMARY'\nThe SQL being executed was: INSERT INTO `entries_meta` (`id`, `archiveDate`, `mainCategoryId`, `parentEntryId`, `internalTitle`, `internalNotes`, `dateCreated`, `dateUpdated`) VALUES (10585849, NULL, NULL, NULL, NULL, NULL, '2026-07-09 08:28:29', '2026-07-09 08:28:29') atvendor/yiisoft/yii2/db/Schema.php:676)\n[previous exception] [object] (PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '10585849' for key 'PRIMARY' atvendor/yiisoft/yii2/db/Command.php:1320)"}
  • POST /admin/entries/pages/1234
web.ERROR] [PDOException] There is already an active transaction {"trace":[
"#0 vendor/yiisoft/yii2/db/Transaction.php(133): PDO->beginTransaction()",
"#1 vendor/yiisoft/yii2/db/Connection.php(798): yii\\db\\Transaction->begin()",
"#2 vendor/craftcms/cms/src/services/Elements.php(3787): yii\\db\\Connection->beginTransaction()",
"#3 vendor/craftcms/cms/src/services/Elements.php(1251): craft\\services\\Elements->{closure:craft\\services\\Elements::_saveElementInternal():3760}()",
"#4 vendor/craftcms/cms/src/services/Elements.php(3760): craft\\services\\Elements->ensureBulkOp()",
"#5 vendor/craftcms/cms/src/services/Elements.php(1337): craft\\services\\Elements->_saveElementInternal()",
"#6 vendor/craftcms/cms/src/controllers/ElementsController.php(1430): craft\\services\\Elements->saveElement()",
"#7 [internal function]: craft\\controllers\\ElementsController->actionSave()",
"#8 vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()",
"#9 vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()",
"#10 vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction()",
"#11 vendor/craftcms/cms/src/web/Application.php(360): yii\\base\\Module->runAction()",
"#12 vendor/craftcms/cms/src/web/Application.php(659): craft\\web\\Application->runAction()",
"#13 vendor/craftcms/cms/src/web/Application.php(322): craft\\web\\Application->_processActionRequest()",
"#14 vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest()",
"#15 web/index.php(16): yii\\base\\Application->run()",
"#16 {main}"],"memory":51570248,
"exception":"[object] (PDOException(code: 0): There is already an active transaction atvendor/yiisoft/yii2/db/Transaction.php:133)"}
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💡
Ideas
1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.