dosubot[bot] commented on issue #7694: URL: https://github.com/apache/incubator-devlake/issues/7694#issuecomment-2207311062
<!-- Answer --> To resolve the issue of the `SELECT * FROM refs ORDER BY created_date desc` query taking too long, you should ensure that the `created_date` column is populated. This column is intended to store the creation date of the references (such as tags or branches) during the normal operation of DevLake <sup>[[1]](https://github.com/apache/incubator-devlake-website/blob/main/versioned_docs/version-v0.20/DataModels/DevLakeDomainLayerSchema.md)</sup>. If the column is not being populated automatically, you might need to check if there are any specific plugins or modules responsible for this. For example, the `ExtractApiRepositories` function in the `backend/plugins/gitee/tasks/repo_extractor.go` file is responsible for extracting and populating the `created_date` column in the `refs` table <sup>[[2]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/gitee/tasks/repo_extractor.go)</sup>. Here is a general approach to populate the `created_date` column if it is currently empty: 1. **Update the `created_date` column with a default value**: ```sql UPDATE refs SET created_date = NOW() WHERE created_date IS NULL; ``` 2. **Ensure that the data extraction logic includes the `created_date`**: Verify that the data extraction processes or plugins are correctly setting the `created_date` field when new data is inserted into the `refs` table. After ensuring the `created_date` column is populated, re-run your query: ```sql SELECT * FROM refs ORDER BY created_date DESC; ``` These steps should help improve the performance of your query. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org