Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1izKqh-0000uw-2a for pgsql-jdbc@arkaria.postgresql.org; Wed, 05 Feb 2020 13:36:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1izKqf-0004x5-Lt for pgsql-jdbc@arkaria.postgresql.org; Wed, 05 Feb 2020 13:36:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1izKAc-0003UP-Hj for pgsql-jdbc@lists.postgresql.org; Wed, 05 Feb 2020 12:52:42 +0000 Received: from out-9.smtp.github.com ([192.30.254.192]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1izKAV-0007Cc-Vp for pgsql-jdbc@lists.postgresql.org; Wed, 05 Feb 2020 12:52:41 +0000 Date: Wed, 05 Feb 2020 04:52:34 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1580907154; bh=VK2nh2wIpmGg6Yo8y4/6WPaUKCGbyH5YDjOzayP9P4I=; h=Date:From:To:Subject:From; b=OIxi0f65YGEA5mZfCWWxgJWulW70J1T9uOVZHu+B6yy6G1D95SABLGegp+uP1KQuI nXGlh15plehMO1mwDat+dNYQCPFhfQwGIQRSGMMJyeicWZLEJvH13CWUA8jF3quPgg N8VJIlR1L2WOk+PubrdomWQE3KiaXxrNA372Bp3M= From: bjanczak To: pgsql-jdbc@lists.postgresql.org Message-ID: Subject: [pgjdbc/pgjdbc] ad8232: Metadata queries improvment (#1694) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Approved: 58GruLoMopuc X-GitHub-Recipient-Address: pgsql-jdbc@lists.postgresql.org X-Auto-Response-Suppress: All List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Branch: refs/heads/release/master Home: https://github.com/pgjdbc/pgjdbc Commit: ad8232d7e320f7ffc43dd13d8c933e134396396d https://github.com/pgjdbc/pgjdbc/commit/ad8232d7e320f7ffc43dd13d8c933e134396396d Author: bjanczak Date: 2020-02-04 (Tue, 04 Feb 2020) Changed paths: M pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java M pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java Log Message: ----------- Metadata queries improvment (#1694) * Metadata queries improvements. When dealing with large PostrgeSQL databases of thousands of schemas, tens of thousands of tables and millions of indexes particular PgDatabaseMetaData methods have suboptimal implementation. The pattern that was utilized in implementation used inner query on pg_catalog.pg_index in order to retrieve keys (information_schema._pg_expandarray(i.indkey) AS keys). Such implementation forced full table scan on pg_catalog.pg_index prior to filtering result set on schema and table name. The optimization idea was to get rid of inner querry in order to let querry planner to avoid full table scan and filter out pg_catalog.pg_index rows prior to executing (information_schema._pg_expandarray(i.indkey) AS keys). * Add test for column order.