Skip to content

[Improvement] Optimize load database method in JdbcDatabaseOperations #6629

Closed
@yuqi1129

Description

@yuqi1129

What would you like to be improved?

load method in JdbcDatabaseOperations will load all databases. if there are a lot of databases, it takes a lot of time.

  @Override
  public JdbcSchema load(String databaseName) throws NoSuchSchemaException {
    // We need to load the database as needed NOT load them all. 
    List<String> allDatabases = listDatabases();
    String dbName =
        allDatabases.stream()
            .filter(db -> db.equals(databaseName))
            .findFirst()
            .orElseThrow(
                () -> new NoSuchSchemaException("Database %s could not be found", databaseName));

    return JdbcSchema.builder()
        .withName(dbName)
        .withProperties(ImmutableMap.of())
        .withAuditInfo(AuditInfo.EMPTY)
        .build();
  }

How should we improve?

No response

Metadata

Metadata

Assignees

Labels

0.9.0Release v0.9.0improvementImprovements on everything

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions