Skip to content

Add database debug hint in development doc

What does this MR do?

In development docs page, under the section: https://docs.gitlab.com/ee/development/#debugging , add a link on how to use Verbose Query Logs in rails console to trace the source of SQL query. It is useful hint for debugging and identifying performance problems.

It will looks like:

Tracing the source of an SQL query in rails console using Verbose Query Logs

Related issues

No issue for this simple change.

But a little bit background: during performance improvement analysis for issue #39112 (closed), I identified some SQL queries as improvement candidates. However it is not easy to position the source code where these SQL are generated from.

I have tried https://docs.gitlab.com/ee/development/database_query_comments.html which is in the same debugging section on development doc https://docs.gitlab.com/ee/development/README.html#debugging. And I found it is not easy to work for Rails console(with complex code, it give stack level too deep error).

While Verbose Query Logs works very well in Rails console, so it is worth to add this information so other developers can refer to. It seems not many people know it.

Author's checklist

Review checklist

All reviewers can help ensure accuracy, clarity, completeness, and adherence to the Documentation Guidelines and Style Guide.

1. Primary Reviewer

  • Review by a code reviewer or other selected colleague to confirm accuracy, clarity, and completeness. This can be skipped for minor fixes without substantive content changes.

2. Technical Writer

  • Optional: Technical writer review. If not requested for this MR, must be scheduled post-merge. To request for this MR, assign the writer listed for the applicable DevOps stage.

3. Maintainer

  1. Review by assigned maintainer, who can always request/require the above reviews. Maintainer's review can occur before or after a technical writer review.
  2. Ensure a release milestone is set.
  3. If there has not been a technical writer review, create an issue for one using the Doc Review template.
Edited by 🤖 GitLab Bot 🤖

Merge request reports