title: Postgres - approximate number of rows in partitioned tables
body: <p>I am looking for a way to approximate the number of rows in a partitioned table. I want to avoid using <code>count(*)</code> because of the size of the data. I tried using this:</p>
  
  <pre><code>SELECT reltuples FROM pg_class WHERE relname = 'my_table_name';
  </code></pre>
  
  <p>but it always returns <code>zero</code>. I am assuming it's because that table is partitioned. </p>
  
  <p>Is there a way to use <code>pg_class/pg_inherits</code> to get the number of rows in all partitions? </p>
  
  <p>Any ideas are much appreciated!</p>