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 1i1I2k-0004wV-17 for pgsql-general@arkaria.postgresql.org; Fri, 23 Aug 2019 22:28:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i1I2i-00016Q-Ld for pgsql-general@arkaria.postgresql.org; Fri, 23 Aug 2019 22:28:24 +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 1i1I2i-0000vN-55 for pgsql-general@lists.postgresql.org; Fri, 23 Aug 2019 22:28:24 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1i1I2f-0004FH-12 for pgsql-general@postgresql.org; Fri, 23 Aug 2019 22:28:22 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id E3E7B1693E478 for ; Fri, 23 Aug 2019 15:28:19 -0700 (MST) Date: Fri, 23 Aug 2019 15:28:19 -0700 (MST) From: PegoraroF10 To: pgsql-general@postgresql.org Message-ID: <1566599299931-0.post@n3.nabble.com> In-Reply-To: References: <1565879436637-0.post@n3.nabble.com> <1565896167022-0.post@n3.nabble.com> <88609b1c-1653-6d4c-c1b4-883e109f5b93@aklaver.com> <1565963536657-0.post@n3.nabble.com> <19659.1565966519@sss.pgh.pa.us> <1565968275886-0.post@n3.nabble.com> <1566596875387-0.post@n3.nabble.com> Subject: Re: slow queries on system tables MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk https://explain.depesz.com/s/5Rrd EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS) SELECT current_database() AS TABLE_CATALOG, n.nspname AS TABLE_SCHEMA, t.relname AS TABLE_NAME, t.oid AS TABLE_OID, current_database() AS INDEX_CATALOG, n.nspname AS INDEX_SCHEMA, c.relname AS INDEX_NAME, c.oid AS INDEX_OID, a.attname AS COLUMN_NAME, a.attnum AS COLUMN_POSITION,indoption[index] & 1 AS DESCENDING , indisunique::integer AS UNIQUE FROM (SELECT generate_series(0, indnatts - 1), indrelid, indexrelid, indkey, indoption, indisunique, indisprimary FROM pg_index i) i(index, indrelid, indexrelid, indkey, indoption, indisunique, indisprimary) INNER JOIN pg_class c ON c.oid = indexrelid INNER JOIN pg_class t ON t.oid = indrelid INNER JOIN pg_namespace n ON n.oid = t.relnamespace INNER JOIN pg_attribute a ON a.attrelid = indrelid AND a.attnum = indkey[index] WHERE n.nspname LIKE 'f10_0275, public' AND t.relname LIKE 'sys_var' ORDER BY indisprimary::integer DESC, n.nspname, t.relname, c.relname, a.attnum; -- Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html