[PR #3528] [CLOSED] Add podcastId index to podcastEpisodes #4004

Closed
opened 2026-04-25 00:17:55 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/3528
Author: @drwggm
Created: 10/17/2024
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • 8e493fd Add podcastId index to podcastEpisodes

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 server/models/PodcastEpisode.js (+1 -1)

📄 Description

I have roughly 40k podcast episodes on around 200 podcasts, and performance was becoming an issue. I noticed the only index on podcastEpisodes was createdAt. Since joins are frequently done between podcasts and podcastEpisodes this will slow things down quite a bit without an index. There is a foreign key constraint, but AFAIK sqlite3 does not create an index for FKs automatically.

This change adds an index on podcastEpisodes.podcastId. It improves performance (loading time) for me on the /library/......, /library/.../bookshelf, and /library/...../podcast/latest webpages

I am not a JS dev. I looked through the migration code, and it seems like the addition of an index should migrate, but I am unsure.

Feel free to ask questions, or I'm on discord too (mggw)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/3528 **Author:** [@drwggm](https://github.com/drwggm) **Created:** 10/17/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`8e493fd`](https://github.com/advplyr/audiobookshelf/commit/8e493fdafa41e0f01ea0729190abe889cac6e19c) Add podcastId index to podcastEpisodes ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `server/models/PodcastEpisode.js` (+1 -1) </details> ### 📄 Description I have roughly 40k podcast episodes on around 200 podcasts, and performance was becoming an issue. I noticed the only index on `podcastEpisodes` was `createdAt`. Since joins are frequently done between `podcasts` and `podcastEpisodes` this will slow things down quite a bit without an index. There is a foreign key constraint, but AFAIK sqlite3 does not create an index for FKs automatically. This change adds an index on `podcastEpisodes.podcastId`. It improves performance (loading time) for me on the `/library/......`, `/library/.../bookshelf`, and `/library/...../podcast/latest` webpages I am not a JS dev. I looked through the migration code, and it seems like the addition of an index should migrate, but I am unsure. Feel free to ask questions, or I'm on discord too (mggw) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:17:55 +02:00
adam closed this issue 2026-04-25 00:17:56 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4004