You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/08/29 08:36:08 UTC

[GitHub] [incubator-shardingsphere] daiduan commented on issue #1951: Optimization of table metadata initialization

daiduan commented on issue #1951: Optimization of table metadata initialization
URL: https://github.com/apache/incubator-shardingsphere/issues/1951#issuecomment-526085641
 
 
   @tristaZero Hello, I am using shardingsphere3.1.0. In #1944,  it has solved the problem of not loading the schema when loading all the tables, but it also does not consider the schema when loading all the columns of the table in `TableMetaDataLoader`. When using the oracle database, if the oracle user has multiple schema view permissions, it will get all the columns of the same name table, it will also make the system start slower. 
   `private List<ColumnMetaData> getColumnMetaDataList(final Connection connection, final String catalog, final String actualTableName) throws SQLException {
           List<ColumnMetaData> result = new LinkedList<>();
           Collection<String> primaryKeys = getPrimaryKeys(connection, catalog, actualTableName);
           try (ResultSet resultSet = connection.getMetaData().getColumns(catalog, null, actualTableName, null)) {
               while (resultSet.next()) {
                   String columnName = resultSet.getString("COLUMN_NAME");
                   String columnType = resultSet.getString("TYPE_NAME");
                   result.add(new ColumnMetaData(columnName, columnType, primaryKeys.contains(columnName)));
               }
           }
           return result;
       }`
   Is it possible to add `connection.getSchema()`  as parameter in `getColumns `as well?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services