# Slow Response - Optimize DB helps for a short time

**URL:** <https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440>\
**Category:** Plex Media Server\
**Tags:** server-windows\
**Created:** [November 17, 2020, 4:47am UTC](https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440 "2020-11-17T04:47:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![svtmustangcobra96\_gmail.com](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@svtmustangcobra96\_gmail.com](https://forums.plex.tv/u/svtmustangcobra96_gmail.com)\
**Post date:** [November 17, 2020, 4:47am UTC](https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440/1 "2020-11-17T04:47:40Z")

</div>

Server Version#: 1.20.5.3600

I have been noticing some lag with loading the interface lately. It spans across various devices (Apple TV, Nvida Shield, iOS devices and the web console). It will take an extended time to load a movie’s details page (meaning the page where the description is and you can start play back, view the trailer, etc.). I would say anywhere from 25-75 seconds. Same happens with TV shows. I haven’t streamed non-synced music recently, so cant say if its occurring with music as well or not.

I have noticed some improvements if i manually optimize the database (it is doing a weekly optimize in the default settings). In the last 48hrs i have optimized it twice though. I am wondering if there a way to see if there is an issue with the db (i dont have much db experience) and also if there is a way to more frequently optimize it until i can resolve it another way.

I should also note, I did just upgrade to the latest version an hour or so ago; and did an immediate optimization following that. If this was a known issue for the previous version then this may be a moot point. I did not see anything in the latest release notes about this type of issue thought (unless i missed it).

Thanks

---

<div class="post-metadata">

**Author:** ![svtmustangcobra96\_gmail.com](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@svtmustangcobra96\_gmail.com](https://forums.plex.tv/u/svtmustangcobra96_gmail.com)\
**Post date:** [November 18, 2020, 1:46am UTC](https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440/2 "2020-11-18T01:46:46Z")

</div>

anyone?

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [November 18, 2020, 1:53am UTC](https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440/3 "2020-11-18T01:53:29Z")

</div>

> [@svtmustangcobra96\_gmail.com](#):
>
> I am wondering if there a way to see if there is an issue with the db

This article has instructions for checking your database for errors, and steps to attempt a repair if so:  
[https://support.plex.tv/articles/201100678-repair-a-corrupt-database/](https://support.plex.tv/articles/201100678-repair-a-corrupt-database/)

You may also want to check the size of your database; while there is no set size it should be, even those with large libraries seldom see databases in excess of several GB.

---

<div class="post-metadata">

**Author:** ![svtmustangcobra96\_gmail.com](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@svtmustangcobra96\_gmail.com](https://forums.plex.tv/u/svtmustangcobra96_gmail.com)\
**Post date:** [November 18, 2020, 4:31am UTC](https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440/4 "2020-11-18T04:31:45Z")

</div>

Thanks, I’ll take a look tomorrow and see. My library is large. I think last time I looked the db was only around 2gb or so though.

---

<div class="post-metadata">

**Author:** ![svtmustangcobra96\_gmail.com](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@svtmustangcobra96\_gmail.com](https://forums.plex.tv/u/svtmustangcobra96_gmail.com)\
**Post date:** [November 20, 2020, 1:48am UTC](https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440/5 "2020-11-20T01:48:59Z")

</div>

ran through this; will see how it goes. didnt report any specific errors that i saw. Also i was wrong the db is only about 580MB. So smaller then i thought.

---

<div class="post-metadata">

**Author:** ![TeknoJunky](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/teknojunky/32/165055_2.png) [@TeknoJunky](https://forums.plex.tv/u/TeknoJunky)\
**Post date:** [November 20, 2020, 1:51am UTC](https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440/6 "2020-11-20T01:51:52Z")

</div>

If dB is on regular hd, defrag.

Otherwise consider moving to ssd.

If already on ssd, consider doing a manual trim (available from windows defrag).

---

<div class="post-metadata">

**Author:** ![edrock200](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@edrock200](https://forums.plex.tv/u/edrock200)\
**Post date:** [November 20, 2020, 1:57am UTC](https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440/7 "2020-11-20T01:57:35Z")

</div>

I use a script to optimize my db and clean bundles more often than scheduled tasks does. It’s basically just calling a url, I do so via curl but you can use whatever means you prefer.

curl --request PUT [http://127.0.0.1:32400/library/optimize?async=1&X-Plex-Token=](http://127.0.0.1:32400/library/optimize?async=1&X-Plex-Token=)  
sleep 15m  
curl --request PUT [http://127.0.0.1:32400/library/clean/bundles?X-Plex-Token=](http://127.0.0.1:32400/library/clean/bundles?X-Plex-Token=)

Insert your token at the end

---

<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:** [February 18, 2021, 1:57am UTC](https://forums.plex.tv/t/slow-response-optimize-db-helps-for-a-short-time/654440/8 "2021-02-18T01:57:39Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
