8000 Add lowercase index for searching users by attribute by resah · Pull Request #54578 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Open
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
4 changes: 4 additions & 0 deletions docs/documentation/upgrading/topics/changes/changes-27_0_0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ The emails are sent by the `email` executor. It has 4 threads by default and sta
Custom email template providers, including ones that extend `FreeMarkerEmailTemplateProvider`, still send the email right away, so for them the response time still depends on the mail server.
To send it in the background, a provider that extends `FreeMarkerEmailTemplateProvider` can override `supportsBackgroundDelivery()`. Other providers need to implement `EmailTemplateProvider.renderPasswordReset` and `send(RenderedEmail, int, EmailDeliveryListener)`.

=== New index for searching users by attribute

A new index over the table `USER_ATTRIBUTE` has been added to increase the performance for lowercase search queries.

// ------------------------ Deprecated features ------------------------ //
== Deprecated features

Expand Down
20 changes: 20 additions & 0 deletions model/jpa/src/main/resources/META-INF/jpa-changelog-27.0.0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,24 @@
<customChange class="org.keycloak.connections.jpa.updater.liquibase.custom.JpaUpdate27_0_0_OidcIssuerMigration"/>
</changeSet>

<!-- Searching users by attribute compares lower(VALUE), which the (NAME, VALUE) index cannot serve.
MariaDB, MSSQL and H2 do not support expression indexes, so the index is only created where it can be. -->
<changeSet author="keycloak" id="27.0.0-user-attribute-lower-value-index">
Comment thread
resah marked this conversation as resolved.
Resolved
<preConditions >
<or>
<dbms type="postgresql"/>
<dbms type="oracle"/>
<dbms type="mysql"/>
</or>
</preConditions>
<createIndex tableName="USER_ATTRIBUTE" indexName="IDX_USER_ATTR_NAME_LOWER_VAL">
<column name="NAME" type="VARCHAR(255)"/>
<column name="LOWER(VALUE)" valueComputed="LOWER(VALUE)"/>
</createIndex>
<modifySql dbms="mysql">
<!-- MySQL requires functional key parts to be wrapped in parentheses -->
<replace replace="LOWER(VALUE)" with="(LOWER(VALUE))"/>
</modifySql>
</changeSet>

</databaseChangeLog>
Loading
0