Search Postgresql Archives

tsearch2: very slow queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




'k, I'm obviously doing something wrong, since my experiences with sites like fts.postgresql.org indicate things should be *alot* faster then I'm getting ...

I have a *very* simple table:

=# \d article_tsearch
  Table "public.article_tsearch"
   Column   |   Type   | Modifiers
------------+----------+-----------
 article_id | integer  |
 idxft1     | tsvector |
Indexes:
    "at_idxft1_idx" gist (idxft1)

rblog=# select count(1) from article_tsearch;
 count
--------
 643072
(1 row)

rblog=# select count(1) from article_tsearch where idxFT1 @@ to_tsquery('1&dvd');;
 count
-------
  1681
(1 row)

But, it just seems to take so long to do the query itself:

# explain analyze select * from article_tsearch where idxFT1 @@ to_tsquery('1&dvd') order by rank(idxFT1, to_tsquery('1&dvd')) desc limit 26;
QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=2625.53..2625.60 rows=26 width=36) (actual time=20164.262..20164.597 rows=26 loops=1)
   ->  Sort  (cost=2625.53..2627.14 rows=644 width=36) (actual time=20164.257..20164.298 rows=26 loops=1)
         Sort Key: rank(idxft1, '\'1\' & \'dvd\''::tsquery)
         ->  Index Scan using at_idxft1_idx on article_tsearch  (cost=0.00..2595.48 rows=644 width=36) (actual time=29.476..20153.530 rows=1681 loops=1)
               Index Cond: (idxft1 @@ '\'1\' & \'dvd\''::tsquery)
               Filter: (idxft1 @@ '\'1\' & \'dvd\''::tsquery)
 Total runtime: 20166.326 ms
(7 rows)

If it is, then I'm obviously overlooking something key here ... now, I've read through the docs in contrib/tsearch2/docs, and don't *think* I've missed anything obvious ... it seems fairly straightforward ...

Is there something else I should be doing to speed the query up any? Or is this fairly normal?

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@xxxxxxx           Yahoo!: yscrappy              ICQ: 7615664

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux