Queries that include index scans and nonindex scan filters
You might experience slowness
in queries that combine etx index scans and filters specified
in a WHERE clause. For example, you might expect the following query
to run fast because the WHERE clause filters any row that does not
have ID
18
:
SELECT COUNT(*) FROM recipes
WHERE etx_contains ( ingredients, 'eggs') and id = 18;
The preceding query, however, runs about as fast as the
following query:
SELECT COUNT(*) FROM recipes
WHERE etx_contains ( ingredients, 'eggs');
If a query includes an etx_contains scan, it completes the scan before it applies any additional filters. When you execute a query that contains an etx_contains scan, remember that the time needed to perform the query is first affected by the number of rows found in the index and then by the number of rows found by the SQL statement.
In each of the preceding cases, the time it takes to execute the query is proportional to the number of recipes that contain the word eggs—even if recipe 18 does not use any eggs.