The update process for the dataset_keyword_tables table is extremely slow. #6962

Closed
opened 2026-02-21 18:18:09 -05:00 by yindo · 2 comments
Owner

Originally created by @imaben on GitHub (Nov 26, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.10

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

When the number of documents in the knowledge base increases, indexing becomes exceptionally slow. After investigation, the main issue was found to be in the update of the dataset_keyword_tables table. Initial investigation suggests that the problem is due to full updates. I would like to ask if it is possible to disable write operations to this table, or if there are any plans for future updates?

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @imaben on GitHub (Nov 26, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.10 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![image](https://github.com/user-attachments/assets/3076da18-3d92-41ab-8c87-457a3f45b3df) When the number of documents in the knowledge base increases, indexing becomes exceptionally slow. After investigation, the main issue was found to be in the update of the dataset_keyword_tables table. Initial investigation suggests that the problem is due to full updates. I would like to ask if it is possible to disable write operations to this table, or if there are any plans for future updates? ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 💪 enhancement label 2026-02-21 18:18:09 -05:00
yindo closed this issue 2026-02-21 18:18:09 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 26, 2024):

Hey @imaben! 👋 I'm here to help you with any bugs, questions, or contributions you have in mind. Let's work together to resolve this issue.

I found a similar unsolved discussion titled How to disable keywords?, which might be relevant to your issue [1].

Regarding your question about disabling write operations to the dataset_keyword_tables table, I couldn't find any existing configurations or settings in Dify that allow for this. Additionally, there are no specific details available about planned updates or improvements addressing performance issues related to this table.

If you are looking for optimizations, you might consider reviewing the indexing process, which involves keyword extraction, updating the keyword table, and saving it back to the database. This process uses a Redis lock to ensure thread safety, which might be a point to investigate for performance improvements [2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 26, 2024): <!-- Greeting --> Hey @imaben! 👋 I'm here to help you with any bugs, questions, or contributions you have in mind. Let's work together to resolve this issue. <!-- Answer --> I found a similar unsolved discussion titled [How to disable keywords?](https://github.com/langgenius/dify/discussions/10152), which might be relevant to your issue <sup>[[1]](https://github.com/langgenius/dify/discussions/10152)</sup>. Regarding your question about disabling write operations to the `dataset_keyword_tables` table, I couldn't find any existing configurations or settings in Dify that allow for this. Additionally, there are no specific details available about planned updates or improvements addressing performance issues related to this table. If you are looking for optimizations, you might consider reviewing the indexing process, which involves keyword extraction, updating the keyword table, and saving it back to the database. This process uses a Redis lock to ensure thread safety, which might be a point to investigate for performance improvements <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/rag/datasource/keyword/jieba/jieba.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@shawn-maxiao commented on GitHub (Feb 1, 2025):

I have read the source to find why.
I find the extract keywords function very slow( 2~5 seconds ), the function uses Jieba to extract keywords for every document chunk.
And there is one redis lock, which makes the other extract-keywords threads wait for the extract-keywords thread which is executing, this causes the process looks like one-by-one instead of parallel.
How to solve it?

@shawn-maxiao commented on GitHub (Feb 1, 2025): I have read the source to find why. I find the extract keywords function very slow( 2~5 seconds ), the function uses Jieba to extract keywords for every document chunk. And there is one redis lock, which makes the other extract-keywords threads wait for the extract-keywords thread which is executing, this causes the process looks like one-by-one instead of parallel. How to solve it?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6962