Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further improve DB query performance #804

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP INDEX CONCURRENTLY IF EXISTS secret_name_unique;
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface CredentialRepository : JpaRepository<Credential?, UUID?> {
value = "select credential.uuid, credential.name, credential.name_lowercase, credential.checksum from certificate_credential " +
"left join credential_version on certificate_credential.uuid = credential_version.uuid " +
"join credential on credential.uuid = credential_version.credential_uuid " +
"where credential.name = ?1 limit 1 ",
"where credential.name_lowercase = lower(?1) limit 1 ",
nativeQuery = true,
)
fun findCertificateByName(name: String?): Credential?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ constructor(
" SELECT credential_uuid, max(version_created_at) AS max_version_created_at\n" +
" FROM credential_version\n" +
" GROUP BY credential_uuid) AS credential_uuid_of_max_version_created_at\n" +
" INNER JOIN (SELECT * FROM credential WHERE lower(name) LIKE lower(?)) AS name\n" +
" INNER JOIN (SELECT * FROM credential WHERE name_lowercase LIKE lower(?)) AS name\n" +
" ON credential_uuid_of_max_version_created_at.credential_uuid = name.uuid\n" +
" INNER JOIN credential_version AS latest_credential_version\n" +
" ON latest_credential_version.credential_uuid =\n" +
Expand Down