(a) it does not work (you cannot positively guarantee a plan will not
be chosen just by setting its cost high) and (b) it is unnecessary.
pg_am.amoptionalkey = false is the right way, and you already have that.

From docs:
>>>>>
When amcanmulticol is false, amoptionalkey essentially says whether the access method allows full-index scans without any restriction clause.
<<<<<

amcanmulticol doesn't resolve issue, because restriction clause might present, but it might have not any actual values ( void tsquery, void array ) and semantic meaning of void query might be a 'any tuple matches'. Suggested gincostestimation's patch allows to prevent from index in some situations, I imagine, that isn't a good solution for two reason:
 - high cost doesn't guarantee an indexscan will be choosen
 - Doesn't work with anything except Const query
But I didn't  find a better place to insert it to resolve first point.

Sorry, but now I have no idea how to produce GIN's fullindex scan without disaster performance gap. If you insist then I'll remove whole new code in gincostestimate...


--
Teodor Sigaev                                   E-mail: [EMAIL PROTECTED]
                                                   WWW: http://www.sigaev.ru/

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to