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 1iyvu9-0007g5-0p for pgsql-jdbc@arkaria.postgresql.org; Tue, 04 Feb 2020 10:58:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iyvu6-000615-W7 for pgsql-jdbc@arkaria.postgresql.org; Tue, 04 Feb 2020 10:58:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iyvu6-00060y-Lf for pgsql-jdbc@lists.postgresql.org; Tue, 04 Feb 2020 10:58:02 +0000 Received: from out-10.smtp.github.com ([192.30.254.193]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iyvu4-00023h-Mo for pgsql-jdbc@lists.postgresql.org; Tue, 04 Feb 2020 10:58:02 +0000 Date: Tue, 04 Feb 2020 02:57:57 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1580813878; bh=r5S1G2krU96TOq9WzP8n9vRo8qy6e2SIuEPZUPTKdPI=; h=Date:From:To:Subject:From; b=0lkds2pu1+kbiioZUOMuASwJg7UBanoVK+OCsVJ8oeyf+gKK8nU6rh2yQVi4Zm/3h LlSZ9078GBCqnpEsCGikWqKEXw1owRYoJQJunAA4IPSJdIy3LQbHFCOUEP4LOV1OOX 3H0VbaELKv8Oa84QEhlp1ask/TEQxZjLvxC4w3IQ= 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/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.