From 3dec29f7895acb42cddf7fed0de479e82b4d9fb3 Mon Sep 17 00:00:00 2001 From: Yoshiyuki Tabata Date: Fri, 11 Dec 2020 16:51:49 +0900 Subject: [PATCH] KEYCLOAK-11908 Support for conditional creating indices based on number --- upgrading/topics/migrate_db.adoc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/upgrading/topics/migrate_db.adoc b/upgrading/topics/migrate_db.adoc index d99547c560..3722b3146b 100644 --- a/upgrading/topics/migrate_db.adoc +++ b/upgrading/topics/migrate_db.adoc @@ -32,6 +32,34 @@ Or run this CLI command: When you start the server with this setting your database is automatically migrated if the database schema has changed in the new version. +Creating an index on huge tables with millions of records can easily take a huge amount of time +and potentially cause major service disruption on upgrades. +For those cases, we added a threshold (the number of records) for automated index creation. +By default, this threshold is `100000` records. +When the number of records is higher than the threshold, the index is not created automatically, +and there will be a warning message in server logs including SQL commands which can be applied later manually. + +To change the threshold, set the `indexCreationThreshold` property, value for the default `connectionsLiquibase` provider: + +[source,xml] +---- + + + + + + + +---- + +Or run this CLI command: + +[source,bash] +---- +/subsystem=keycloak-server/spi=connectionsLiquibase/:add(default-provider=default) +/subsystem=keycloak-server/spi=connectionsLiquibase/provider=default/:add(properties={indexCreationThreshold => "100000"},enabled=true) +---- + === Manual Relational Database Migration To enable manual upgrading of the database schema, set the migrationStrategy property value to "manual" for the default