pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Benoit Delbosc <bdelbosc@nuxeo.com>
To: pgsql-performance@postgresql.org
Subject: Re: Slow fulltext query plan
Date: Fri, 13 Apr 2012 00:56:11 +0200
Message-ID: <4F875D8B.6020802@nuxeo.com> (raw)
In-Reply-To: <6273.1334269559@sss.pgh.pa.us>
References: <4F875293.1000100@nuxeo.com>
	<6273.1334269559@sss.pgh.pa.us>

On 13/04/2012 00:25, Tom Lane wrote:
> Benoit Delbosc<bdelbosc@nuxeo.com>  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_tsvector(fulltext.fulltext)) OR (query2 @@
>> nx_to_tsvector(fulltext.fulltext_title));
> Is there a reason why you're writing the query in such a
> non-straightforward way, rather than just
>
>     EXPLAIN ANALYZE SELECT hierarchy.id
>     FROM hierarchy
>     JOIN fulltext ON fulltext.id = hierarchy.id
>     WHERE (TO_TSQUERY('whatever') @@ nx_to_tsvector(fulltext.fulltext))
>        OR (TO_TSQUERY('whatever') @@ nx_to_tsvector(fulltext.fulltext_title));
>
> ?
>
This query is written by a framework, also I thought that is a common 
pattern that can be found in the documentation:

   http://www.postgresql.org/docs/9.1/interactive/textsearch-controls.html

if you think this a wrong way to do it then I will try to fix the framework.

btw your version takes 15ms :)

Thanks

ben



view thread (5+ messages)  latest in thread

Message-ID: <4F875D8B.6020802@nuxeo.com>
Permalink:  ../4F875D8B.6020802@nuxeo.com/
Also on:    postgresql.org/message-id/4F875D8B.6020802@nuxeo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: bdelbosc@nuxeo.com
  Subject: Re: Slow fulltext query plan
  In-Reply-To: <4F875D8B.6020802@nuxeo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox