On Thu, Jul 14, 2016 at 12:38 PM, Dilip Kumar <dilipbal...@gmail.com> wrote:

> I am not sure what should be the correct fix for this problem.
> I think even if we try to call this function on index oid
> *pg_get_indexdef(*x.indexrelid*) *AS indexdef, problem will not be
> solved, because both will fall in same equivalence class hence clause can
> be distributed to pg_class also.

I was wrong, Actually If we change the view and call function on
x.indexrelid, It will fix the issue, because *pg_get_indexdef(*x.indexrelid*)
*is non equal clause and of course will not fall in same equivalence class.

Patch is attached for the same..

*Plan after patch: *(Now it pushed to pg_index table, which is perfectly

 Nested Loop Left Join  (cost=22.36..39.30 rows=9 width=288)
   Join Filter: (t.oid = i.reltablespace)
   ->  Hash Left Join  (cost=22.36..37.98 rows=9 width=200)
         Hash Cond: (c.relnamespace = n.oid)
         ->  Hash Join  (cost=21.23..36.72 rows=9 width=140)
               Hash Cond: (i.oid = x.indexrelid)
               ->  Seq Scan on pg_class i  (cost=0.00..14.95 rows=121
                     *Filter: (relkind = 'i'::"char")*
               ->  Hash  (cost=20.93..20.93 rows=24 width=72)
                     ->  Hash Join  (cost=15.72..20.93 rows=24 width=72)
                           Hash Cond: (x.indrelid = c.oid)
                           ->  Seq Scan on pg_index x  (cost=0.00..4.51
rows=120 width=8)
                                * Filter: (pg_get_indexdef(indexrelid) IS

Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

Attachment: pg_indexes_fix.patch
Description: Binary data

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to