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 1iFnFW-0006cL-Gs for pgsql-general@arkaria.postgresql.org; Wed, 02 Oct 2019 22:37:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iFnFV-0004bX-0r for pgsql-general@arkaria.postgresql.org; Wed, 02 Oct 2019 22:37:33 +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 1iFnFU-0004bK-Kq for pgsql-general@lists.postgresql.org; Wed, 02 Oct 2019 22:37:32 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1iFnFR-0007CD-9o for pgsql-general@postgresql.org; Wed, 02 Oct 2019 22:37:31 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 946D9179EF134 for ; Wed, 2 Oct 2019 15:37:27 -0700 (MST) Date: Wed, 2 Oct 2019 15:37:27 -0700 (MST) From: legrand legrand To: pgsql-general@postgresql.org Message-ID: <1570055847573-0.post@n3.nabble.com> In-Reply-To: References: Subject: Re: Questions about Partitioned Tables and Indexes 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 Hi, what you proposed seems correct to me. I don't know how to list indexes from a partitionned index. You can check if your indexes are valid using: select i.relname as indexname,i.relkind, t.relname as tablename, t.relkind, idx.indisvalid from pg_class i join pg_index idx on idx.indexrelid = i.oid join pg_class t on t.oid = idx.indrelid where t.relname like 'test%' to be really sure, try EXPLAIN with statements that should use those indexes like postgres=# explain select * from test_part where date_key >0; QUERY PLAN --------------------------------------------------------------------------------------- Append (cost=6.53..43.80 rows=614 width=60) -> Bitmap Heap Scan on test_201908 (cost=6.53..20.37 rows=307 width=60) Recheck Cond: (date_key > '0'::numeric) -> Bitmap Index Scan on test_201908_pkey (cost=0.00..6.45 rows=307 width=0) Index Cond: (date_key > '0'::numeric) -> Bitmap Heap Scan on test_201909 (cost=6.53..20.37 rows=307 width=60) Recheck Cond: (date_key > '0'::numeric) -> Bitmap Index Scan on test_201909_pkey (cost=0.00..6.45 rows=307 width=0) Index Cond: (date_key > '0'::numeric) (9 rows) or postgres=# explain select * from test_part where metric >0; QUERY PLAN --------------------------------------------------------------------------------------------- Append (cost=6.53..43.80 rows=614 width=60) -> Bitmap Heap Scan on test_201908 (cost=6.53..20.37 rows=307 width=60) Recheck Cond: (metric > '0'::numeric) -> Bitmap Index Scan on test_idx1_201908 (cost=0.00..6.45 rows=307 width=0) Index Cond: (metric > '0'::numeric) -> Bitmap Heap Scan on test_201909 (cost=6.53..20.37 rows=307 width=60) Recheck Cond: (metric > '0'::numeric) -> Bitmap Index Scan on test_201909_metric_idx (cost=0.00..6.45 rows=307 width=0) Index Cond: (metric > '0'::numeric) (9 rows) Regards PAscal -- Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html