Re: [PERFORM] Slow fulltext query plan

2012-04-12 Thread Benoit Delbosc
On 13/04/2012 00:25, Tom Lane wrote: Benoit Delbosc writes: EXPLAIN ANALYZE SELECT hierarchy.id FROM hierarchy JOIN fulltext ON fulltext.id = hierarchy.id, TO_TSQUERY('whatever') query1, TO_TSQUERY('whatever') query2 WHERE (query1 @@ nx_to_tsvect

[PERFORM] Slow fulltext query plan

2012-04-12 Thread Benoit Delbosc
Hi, I would like to understand why the following query execution don't use any fulltext indexes and takes more than 300s (using lot of temporary files): EXPLAIN ANALYZE SELECT hierarchy.id FROM hierarchy JOIN fulltext ON fulltext.id = hierarchy.id, TO_TSQUERY('whatever') query1, TO_T

Re: [PERFORM] Bad query plan inside EXISTS clause

2010-03-10 Thread Benoit Delbosc
Tom Lane a écrit : Benoit Delbosc writes: I am trying to understand why inside an EXISTS clause the query planner does not use the index: I'm not sure this plan is as bad as all that. The key point is that the planner is expecting 52517 rows that match that users_md5 value (and the

Re: [PERFORM] Bad query plan inside EXISTS clause

2010-03-10 Thread Benoit Delbosc
Yeb Havinga a écrit : Yeb Havinga wrote: Kenneth Marshall wrote: EXISTS matches NULLs too and since they are not indexed a sequential scan is needed to check for them. Try using IN instead. This is nonsense in more than one way. Hit ctrl-return a bit too slow - exists does not match null bu

[PERFORM] Bad query plan inside EXISTS clause

2010-03-10 Thread Benoit Delbosc
Hi all, I am trying to understand why inside an EXISTS clause the query planner does not use the index: EXPLAIN ANALYZE SELECT 1 WHERE EXISTS (SELECT 1 FROM read_acls_cache WHERE users_md5 = '9bc9012eb29c0bb2ae3cc7b5e78c2acf'); QUERY PLAN