Similarity search with the tsearch2 extension - Mailing list pgsql-performance

From Janek Sendrowski
Subject Similarity search with the tsearch2 extension
Date
Msg-id trinity-de58bc2b-0ed7-49fc-86e9-c5a4df0994e0-1386340257615@3capp-webde-bs33
Whole thread Raw
Responses Re: Similarity search with the tsearch2 extension
List pgsql-performance
Hi,
 
I want to realize a Full Text Search with the tsearch2 extension. It should find similar sentences.
 
I used my own trigger to store the tsvector of the sentences and I created a usual gist index on them.
I have to to use many OR statements with a low set of arguments, what heavy damages the performance.
My former query looked like this:
 
SELECT strip(to_tsvector('The tiger  is the largest cat species, reaching a total body length of up to 3.3 m  and
weighingup to 306 kg.')); 
                                           strip
----------------------------------------------------------------------------------------------
 '3.3' '306' 'bodi' 'cat' 'kg' 'largest' 'length' 'm' 'reach' 'speci' 'tiger' 'total' 'weigh'
(1 row)
 
SELECT * FROM tablename WHERE vector @@ to_tsquery('speci & tiger & total & weigh') AND vector @@
to_tsquery('largest & length & m & reach')  ANDvector @@ to_tsquery('3.3 & 306 & bodi & cat & kg'); 

And thats very slow.
Is there a better solution like a functional index?

Thank you for your help.
 
Janek Sendrowski


pgsql-performance by date:

Previous
From: Rosser Schwarz
Date:
Subject: Re: WAL + SSD = slow inserts?
Next
From: Kevin Grittner
Date:
Subject: Re: Similarity search with the tsearch2 extension