[SQL] tsearch2: ts_headline performance problem

2008-01-06 Thread Anders Østergaard Jensen
Hi there people, I'm trying to build a text search engine for relatively large PDF documents with a web frontend. I use PostgreSQL 8.3 beta3/4 with tsearch2 for full-text indexing. Everything performs quite well, until I start indexing 800 pages of text into the database (with the utf8 da

Re: [SQL] tsearch2: ts_headline performance problem

2008-01-06 Thread Oleg Bartunov
Anders, headline is a slow, since it should read and process an original document, so you should avoid simple search query, which calculates ts_headline() for each document in the result set. Use subselect instead ! In example below, 2nd query is way faster the 1rd ! select id,headline(body,q),