Re: ORDER BY using index, tsearch2

From: "Janek Sendrowski" <janek12(at)web(dot)de>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: ORDER BY using index, tsearch2
Date: 2013-12-12 01:00:38
Message-ID: trinity-8e504cd8-9ad3-487e-ae13-68e6f8dff0c3-1386810038087@3capp-webde-bs45
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Sorry, I still wanted to add following link: http://www.sai.msu.su/~megera/postgres/talks/Full-text%20search%20in%20PostgreSQL%20in%20milliseconds-extended-version.pdf
On page 6 you can see the first example:

"postgres=# explain analyze
SELECT docid, ts_rank(text_vector, to_tsquery('english', 'title')) AS rank
FROM ti2
WHERE text_vector @@ to_tsquery('english', 'title')
ORDER BY text_vector>< plainto_tsquery('english','title')
LIMIT 3;"

"Limit (cost=20.00..21.65 rows=3 width=282) (actual time=18.376..18.427 rows=3 loops=-> Index Scan using ti2_index on ti2 (cost=20.00..26256.30 rows=47692 width=282)
(actual time=18.375..18.425 rows=3 loops=1)
Index Cond: (text_vector @@ '''titl'''::tsquery)
Order By: (text_vector >< '''titl'''::tsquery)"

My PG-version is 9.3.
I was wondering about this feature, bacause I haven't seen it yet and it a huge speed up.

Sorry, I thought the name is still tsearch, because the functionnames are roughly the same, but now know I noticed, that this name is obsolete.

Janek Sendrowski

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message jacket41142 2013-12-12 03:22:37 Re: select count(distinct ...) is slower than select distinct in about 5x
Previous Message Tom Lane 2013-12-11 23:55:57 Re: ORDER BY using index, tsearch2