Gurjeet Singh <gurj...@singh.im> writes: > Please see attached the patch that does this. Let me know if this patch helps.
I don't like this patch one bit, because it adds a lot of overhead (i.e., an extra index_open/close cycle for every btree index in every query) to support a tiny minority use-case. How come we don't already know whether the index is hypothetical at the point where _bt_getrootheight is called now? Actually, looking at the existing comment at the call site: /* * Allow a plugin to editorialize on the info we obtained from the * catalogs. Actions might include altering the assumed relation size, * removing an index, or adding a hypothetical index to the indexlist. */ if (get_relation_info_hook) (*get_relation_info_hook) (root, relationObjectId, inhparent, rel); reminds me that the design intention was that hypothetical indexes would get added to the list by get_relation_info_hook itself. If that's not how the index adviser is operating, maybe we need to have a discussion about that. regards, tom lane