Re: Issue in pg_catalog.pg_indexes view definition

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Issue in pg_catalog.pg_indexes view definition
Date: 2016-07-14 07:59:26
Message-ID: CAFiTN-sWBg4+tQmh6_Z6E_az0R1QAK4D9eSTuB=kDwwAH3LLcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 14, 2016 at 12:38 PM, Dilip Kumar <dilipbalaut(at)gmail(dot)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
fine)

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
width=72)
*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
NOT NULL)*

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
pg_indexes_fix.patch application/octet-stream 622 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-07-14 08:02:18 Re: pgbench - allow to store select results into variables
Previous Message Fabien COELHO 2016-07-14 07:18:37 Re: unexpected psql "feature"