X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D41A0329FFC; Sun, 3 Oct 2004 21:31:01 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51099-07; Sun, 3 Oct 2004 20:30:57 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8B445329ECA; Sun, 3 Oct 2004 21:30:50 +0100 (BST) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.12.10/8.12.10) with ESMTP id i93KUcQT018494; Mon, 4 Oct 2004 00:30:38 +0400 (MSD) Date: Mon, 4 Oct 2004 00:30:38 +0400 (MSD) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Kris Kiger Cc: Pgsql Hackers , pgsql-admin@postgresql.org Subject: slow count() was: tsearch2 poor performance In-Reply-To: <415DD3CC.3030208@musicrebellion.com> Message-ID: References: <71E37EF6B7DCC1499CEA0316A2568328DC9DF0@loki.wc.globexplorer.net> <4158409E.8060109@musicrebellion.com> <41584E49.5040301@musicrebellion.com> <41586264.5020302@musicrebellion.com> <415DD3CC.3030208@musicrebellion.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/73 X-Sequence-Number: 15066 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@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83