# Optimize error

**URL:** <https://forums.plex.tv/t/optimize-error/146708>\
**Category:** General Discussions\
**Created:** [June 1, 2016, 7:57pm UTC](https://forums.plex.tv/t/optimize-error/146708 "2016-06-01T19:57:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![illimitato](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@illimitato](https://forums.plex.tv/u/illimitato)\
**Post date:** [June 1, 2016, 7:57pm UTC](https://forums.plex.tv/t/optimize-error/146708/1 "2016-06-01T19:57:49Z")

</div>

hi

when i Optimize db i recive this error… any suggestion?

Jun 01, 2016 22:06:20 [0x7f7af03f2700] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:16): 1.470000 seconds  
Jun 01, 2016 22:06:22 [0x7f7af03f2700] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:26): 0.960000 seconds  
Jun 01, 2016 22:06:24 [0x7f7af03f2700] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:35): 2.360000 seconds  
Jun 01, 2016 22:06:25 [0x7f7af03f2700] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:45): 1.290000 seconds  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 22:06:33 [0x7f7af03f2700] WARN - Held transaction for too long (…/Library/DatabaseFixups.cpp:157): 0.280000 seconds  
Jun 01, 2016 22:06:33 [0x7f7af8bfe700] WARN - Took too long (0.260000 seconds) to start a transaction on …/Statistics/StatisticsManager.h:185  
Jun 01, 2016 22:06:33 [0x7f7af8bfe700] WARN - Transaction that was running was started on …/Library/DatabaseFixups.cpp:146

---

<div class="post-metadata">

**Author:** ![OttoKerner](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ottokerner/32/10079_2.png) [@OttoKerner](https://forums.plex.tv/u/OttoKerner)\
**Post date:** [June 1, 2016, 8:21pm UTC](https://forums.plex.tv/t/optimize-error/146708/2 "2016-06-01T20:21:18Z")

</div>

This log snippets actually doesn’t show the database optimization operation but the start of the server after a server update.Only try an optimization after the server has been started up for quite a while.

It must also **not** be busy e.g. doing library updates or other operations which would cause changes to the database.

---

<div class="post-metadata">

**Author:** ![illimitato](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@illimitato](https://forums.plex.tv/u/illimitato)\
**Post date:** [June 1, 2016, 8:53pm UTC](https://forums.plex.tv/t/optimize-error/146708/3 "2016-06-01T20:53:18Z")

</div>

I’m sure this log is generated only when I press the button " optimizes db ".  
I tried to press it three times and three times he has virtually created the same log .

I also tried to restart the service and verify that not doing other activities but the problem persists .

I tried to remove and reinstall the package ( I did not use the purge option ) but it did not work , at this point I doubt that an upgrade from a previous version has not fuzionato properly …

---

<div class="post-metadata">

**Author:** ![illimitato](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@illimitato](https://forums.plex.tv/u/illimitato)\
**Post date:** [June 1, 2016, 8:59pm UTC](https://forums.plex.tv/t/optimize-error/146708/4 "2016-06-01T20:59:00Z")

</div>

Debug:

Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Request: [xx.xx.xx.xx:53888] PUT /library/optimize (3 live) TLS GZIP  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Auth: Came in with a super-token, authorization succeeded.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Database optimization: Optimizing database. Starting by capturing all sessions.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 0.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 1.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 2.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 3.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 4.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 5.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 6.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 7.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 8.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 9.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 10.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 11.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 12.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 13.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 14.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 15.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 16.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 17.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 18.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Captured session 19.  
Jun 01, 2016 23:10:28 [0x7f6f9a7ff700] DEBUG - Database optimization: Rebuilding full text search tables.  
Jun 01, 2016 23:10:29 [0x7f6f9a7ff700] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:16): 1.420000 seconds  
Jun 01, 2016 23:10:30 [0x7f6f9a7ff700] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:26): 0.910000 seconds  
Jun 01, 2016 23:10:33 [0x7f6f9a7ff700] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:35): 2.260000 seconds  
Jun 01, 2016 23:10:34 [0x7f6f9a7ff700] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:45): 1.220000 seconds  
Jun 01, 2016 23:10:34 [0x7f6f9a7ff700] DEBUG - Database optimization: starting.  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] DEBUG - Database optimization: complete.  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] INFO - SQLITE3:0x10, 17, statement aborts at 58: [select \* from metadata\_items limit 1] database schema has changed  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] DEBUG - Running database fix-ups.  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] WARN - Held transaction for too long (…/Library/DatabaseFixups.cpp:157): 0.240000 seconds  
Jun 01, 2016 23:10:42 [0x7f6f9a7ff700] DEBUG - Running database fix-ups completed in 0.2 seconds.  
Jun 01, 2016 23:10:42 [0x7f6fa17fe700] DEBUG - Completed: [xx.xx.xx.xx:53888] PUT /library/optimize (3 live) TLS GZIP 14124ms 231 bytes 200  
Jun 01, 2016 23:10:42 [0x7f6f9f7ff700] VERBOSE - Statistics: (Plex Web (Chrome)) Reporting 231 bytes for account 1 on LAN: 0

---

<div class="post-metadata">

**Author:** ![OttoKerner](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ottokerner/32/10079_2.png) [@OttoKerner](https://forums.plex.tv/u/OttoKerner)\
**Post date:** [June 1, 2016, 9:19pm UTC](https://forums.plex.tv/t/optimize-error/146708/5 "2016-06-01T21:19:47Z")

</div>

Once again, it looks like database optimization overlapped with the database schema changes after a Plex server update.  
Which leads me to believe that your database is corrupt.  
[https://support.plex.tv/hc/en-us/articles/201100678](https://support.plex.tv/hc/en-us/articles/201100678)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [January 7, 2020, 9:26pm UTC](https://forums.plex.tv/t/optimize-error/146708/6 "2020-01-07T21:26:09Z")

</div>


