darold / pgcluu

PostgreSQL Cluster performances monitoring and auditing tool
http://pgcluu.darold.net/
PostgreSQL License
336 stars 45 forks source link

Redundant queries: bug with partitioning #153

Closed Krysztophe closed 1 year ago

Krysztophe commented 2 years ago

The missing indexes query is not partitioning_aware. In a db made with pgbench --foreign-keys --partitions=2, I get this:

 pgbench_accounts   ║ CREATE INDEX CONCURRENTLY idx_pgbench_accounts_bid ON pgbench_accounts (bid) ;
 pgbench_accounts_1 ║ CREATE INDEX CONCURRENTLY idx_pgbench_accounts_1_bid ON pgbench_accounts_1 (bid) ;
 pgbench_accounts_2 ║ CREATE INDEX CONCURRENTLY idx_pgbench_accounts_2_bid ON pgbench_accounts_2 (bid) ;

It seems that this check solves the problem:

                      AND NOT pg_class.relispartition      --v10
                      AND pg_constraint.conparentid = 0 --v11

I may try a PR once #152 is finished.

darold commented 1 year ago

Commit 1ab2632 fixes this issue.