slow count() was: tsearch2 poor performance

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Kris Kiger <kris(at)musicrebellion(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-admin(at)postgresql(dot)org
Subject: slow count() was: tsearch2 poor performance
Date: 2004-10-03 20:30:38
Message-ID: Pine.GSO.4.58.0410040026240.14217@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

On Fri, 1 Oct 2004, Kris Kiger wrote:

> Hey all, its me again. If I do not do a count(product_id) on my
> tsearch2 queries, its actually really fast, for example;
>

Hmm, I also really want to know what's the difference ?
Postgresql 8.0beta3 on Linux 2.4.25

tsearchd=# explain analyze select body from txt where fts_index @@ to_tsquery('oil') limit 1000;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..4027.67 rows=1000 width=315) (actual time=0.053..14.662 rows=1000 loops=1)
-> Index Scan using fts_idx on txt (cost=0.00..12083.02 rows=3000 width=315) (actual time=0.049..12.552 rows=1000 loops=1)
Index Cond: (fts_index @@ '\'oil\''::tsquery)
Total runtime: 15.848 ms
(4 rows)

tsearchd=# explain analyze select count(body) from txt where fts_index @@ to_tsquery('oil') limit 1000;

Didn't get result after 10 minutes :(

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Magnus Hagander 2004-10-03 20:43:50 Re: [HACKERS] slow count() was: tsearch2 poor performance
Previous Message Michael Long 2004-10-03 20:28:54 Re: Users and multiple server environment

Browse pgsql-hackers by date

  From Date Subject
Next Message Dan Libby 2004-10-03 20:30:57 Status ofTrigger Firing Order and 'FOR EACH STATEMENT'?
Previous Message Dave Page 2004-10-03 19:47:06 Re: Checking for overflow of integer arithmetic