Re: [PERFORM] Slow TSearch2 performance for table with 1 million documents.

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Benjamin Arai <benjamin(at)araisoft(dot)com>, PostgreSQL <pgsql-general(at)postgresql(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] Slow TSearch2 performance for table with 1 million documents.
Date: 2007-10-05 15:32:32
Message-ID: Pine.LNX.4.64.0710051932030.3304@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

On Fri, 5 Oct 2007, Tom Lane wrote:

> Benjamin Arai <benjamin(at)araisoft(dot)com> writes:
>> # explain analyze select * FROM fulltext_article, to_tsquery
>> ('simple','dog') AS q WHERE idxfti @@ q ORDER BY rank(idxfti, q) DESC;
>
>> QUERY PLAN
>> ------------------------------------------------------------------------
>> ------------------------------------------------------------------------
>> ------------
>> Sort (cost=6576.74..6579.07 rows=933 width=774) (actual
>> time=12969.237..12970.490 rows=5119 loops=1)
>> Sort Key: rank(fulltext_article.idxfti, q.q)
>> -> Nested Loop (cost=3069.79..6530.71 rows=933 width=774)
>> (actual time=209.513..12955.498 rows=5119 loops=1)
>> -> Function Scan on q (cost=0.00..0.01 rows=1 width=32)
>> (actual time=0.005..0.006 rows=1 loops=1)
>> -> Bitmap Heap Scan on fulltext_article
>> (cost=3069.79..6516.70 rows=933 width=742) (actual
>> time=209.322..234.390 rows=5119 loops=1)
>> Recheck Cond: (fulltext_article.idxfti @@ q.q)
>> -> Bitmap Index Scan on fulltext_article_idxfti_idx
>> (cost=0.00..3069.56 rows=933 width=0) (actual time=208.373..208.373
>> rows=5119 loops=1)
>> Index Cond: (fulltext_article.idxfti @@ q.q)
>> Total runtime: 12973.035 ms
>> (9 rows)
>
> The time seems all spent at the join step, which is odd because it
> really hasn't got much to do. AFAICS all it has to do is compute the
> rank() values that the sort step will use. Is it possible that
> rank() is really slow?

can you try rank_cd() instead ?

>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Geoffrey 2007-10-05 15:34:19 Re: good sql tutorial
Previous Message Gregory Stark 2007-10-05 15:17:36 Re: ERROR: variable not found in subplan target lists

Browse pgsql-performance by date

  From Date Subject
Next Message Arjen van der Meijden 2007-10-05 16:38:22 Re: Problems with + 1 million record table
Previous Message Tom Lane 2007-10-05 15:12:45 Re: Slow TSearch2 performance for table with 1 million documents.