Prepend the Marginalia comment in SQL query
By default, PostgreSQL only records the first 1024 characters of a SQL query. This means for long queries, we often lose the source of the query, which makes it difficult to track down expensive queries, such as one described in https://gitlab.com/gitlab-org/gitlab/-/issues/292047. Increasing the `track_activity_query_size` in PostgreSQL will help, but this requires a reboot of the database. To avoid needing to depend on https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/12314, we prepend the comment as described in https://github.com/basecamp/marginalia#prepend-comments. We disable this for tests because a number of tests expect raw SQL to start the string.
Showing
Please register or sign in to comment