Comment 9 for bug 119780

Revision history for this message
Stuart Bishop (stub) wrote : Re: GIN indexes cause some slow queries to fail entirely

Reopening as we might have a work around that enables us to use GIN indexes. We need GIN indexes to allow us to start searching in bug comments again, as the GIST indexes are just too slow.

The error occurs when a full scan is needed, and the GIN index type does not support this and fails. The work around is to inspect the query tree of the query to see if it will require a full scan, and if so, return a 'Query too general' error message to the user.

launchpad_prod=# select querytree(ftq('-lt'));
 querytree
-----------
 T
(1 row)

launchpad_prod=# select querytree(ftq('gin (index OR indexes) fail'));
               querytree
----------------------------------------
 'gin' & ( 'index' | 'index' ) & 'fail'
(1 row)

If the querytree() function returns 'T', that query will fail if it is
applied to a GIN index.