# Suggested SQLite3 DB Optimizations

**URL:** <https://forums.plex.tv/t/suggested-sqlite3-db-optimizations/794749>\
**Category:** Plex Media Server\
**Tags:** server-linux\
**Created:** [May 29, 2022, 3:20am UTC](https://forums.plex.tv/t/suggested-sqlite3-db-optimizations/794749 "2022-05-29T03:20:42Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![jasonsansone](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jasonsansone/32/291100_2.png) [@jasonsansone](https://forums.plex.tv/u/jasonsansone)\
**Post date:** [May 29, 2022, 3:20am UTC](https://forums.plex.tv/t/suggested-sqlite3-db-optimizations/794749/1 "2022-05-29T03:20:42Z")

</div>

As introduced in a [separate thread](https://forums.plex.tv/t/script-to-regenerate-video-previews-multi-threaded/788360/67), I believe the database could be improved as follows:

- [PRAGMA synchronous](https://www.sqlite.org/pragma.html#pragma_synchronous) from FULL to NORMAL. Note: The DB is already in WAL mode.
- [PRAGMA temp\_store](https://www.sqlite.org/pragma.html#pragma_temp_store) from 0 to 2.
- [Cache size](https://www.sqlite.org/pragma.html#pragma_cache_size) (not default\_cache\_size) enlarged.
- [Page\_size](https://www.sqlite.org/pragma.html#pragma_page_size) enlarged from 1024 (which is the old default but the current SQLite3 default is 4096)
- [PRAGMA locking\_mode](https://www.sqlite.org/pragma.html#pragma_locking_mode) from normal to exclusive.
- [PRAGMA mmap\_size](https://www.sqlite.org/pragma.html#pragma_mmap_size) from 0 to anything.

Edit 05-31-2022: PRAGMA synchronous is already NORMAL as confirmed below. Locking\_mode exclusive can’t be used due to multiple binaries accessing database.

@dane22 @Volts

---

_[View the full topic](https://forums.plex.tv/t/suggested-sqlite3-db-optimizations/794749)._
