From: | "Janek Sendrowski" <janek12(at)web(dot)de> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Similarity search with the tsearch2 extension |
Date: | 2013-12-06 14:30:57 |
Message-ID: | trinity-de58bc2b-0ed7-49fc-86e9-c5a4df0994e0-1386340257615@3capp-webde-bs33 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general 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 weighing up 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') AND vector @@ 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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2013-12-06 14:43:54 | Re: Trust intermediate CA for client certificates |
Previous Message | Janek Sendrowski | 2013-12-06 14:22:41 | Re: Similarity search for sentences |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2013-12-06 14:54:35 | Re: Similarity search with the tsearch2 extension |
Previous Message | Rosser Schwarz | 2013-12-06 06:03:44 | Re: WAL + SSD = slow inserts? |