pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yudie Pg <yudiepg@gmail.com>
To: pgsql-performance@postgresql.org
Subject: How to speed up word count in tsearch2?
Date: Thu, 31 Mar 2005 13:58:30 -0600
Message-ID: <e460d0c05033111584290bc6c@mail.gmail.com> (raw)

(It is the 2nd posting, maybe the 1st one didn't goes thru)
I've tested several keyword count from 2 millions record book
description table that indexed with tseach2 indexing.
The result is always slow for first query attempt.

This my sample query:
-- test one phrase --
SELECT count(*) from table1
WHEREsearchvector @@ to_tsquery('default' ,'david') limit 100
:: returns 16824 records match.
:: take 49618.341 ms (1st attempt)
:: take 504.229 ms (2nd attempt)

-- test two phrase --
SELECT count(*) from table1
WHERE searchvector @@ to_tsquery('default' ,'martha&stewart') limit 100
:: returns 155 records match.
:: take 686.669 ms (1st attempt)
:: take 40.282 ms (2nd attempt)

I use ordinary aggregate function count(*), Is there other way to count faster?



view thread (4+ messages)  latest in thread

Message-ID: <e460d0c05033111584290bc6c@mail.gmail.com>
Permalink:  ../e460d0c05033111584290bc6c@mail.gmail.com/
Also on:    postgresql.org/message-id/e460d0c05033111584290bc6c@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: yudiepg@gmail.com
  Subject: Re: How to speed up word count in tsearch2?
  In-Reply-To: <e460d0c05033111584290bc6c@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox