CockroachDB: use unordered_unique_rowid for primary keys

sequential values in a primary key does not perform as well

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2023-06-10 18:23:35 +02:00
parent d7d7b0bbf0
commit 957d3a7b4d
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF

View file

@ -786,10 +786,11 @@ func (p *PGSQLProvider) initializeDatabase() error {
logger.InfoToConsole("creating initial database schema, version 28")
providerLog(logger.LevelInfo, "creating initial database schema, version 28")
var initialSQL string
if config.Driver == PGSQLDataProviderName {
initialSQL = sqlReplaceAll(pgsqlInitial + ipListsLikeIndex)
} else {
if config.Driver == CockroachDataProviderName {
initialSQL = sqlReplaceAll(pgsqlInitial)
initialSQL = strings.ReplaceAll(initialSQL, "GENERATED ALWAYS AS IDENTITY", "DEFAULT unordered_unique_rowid()")
} else {
initialSQL = sqlReplaceAll(pgsqlInitial + ipListsLikeIndex)
}
return sqlCommonExecSQLAndUpdateDBVersion(p.dbHandle, []string{initialSQL}, 28, true)