javajdbcdatabase-performancedbconnectiondatabase-metadata

DatabaseMetaData().getTables() - is very slow any alternative?


DatabaseMetaData().getTables() - is very slow, Is there any alternative of this?

Following is my actual code :

connection.getMetaData().getTables(null,null,null,new String[] {"TABLE", "VIEW"} );

Solution

  • You can directly fire the below queries through statement in java and obtain the result in resultset

    Oracle:

    select tablespace_name, table_name from dba_tables;
    

    MySQL:

    show tables
    

    PostgreSQL :

    SELECT * FROM pg_catalog.pg_tables;