pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rafa Comino <rafacomino@gmail.com>
To: pgsql-general@postgresql.org
To: pgsql-sql@postgresql.org
To: pgsql-performance@postgresql.org
Subject: Having performance problems with TSearch2
Date: Tue, 20 Feb 2007 11:41:54 +0100
Message-ID: <bd8b58a40702200241y7ad2ae60q4e39bbfcfe1eed2f@mail.gmail.com> (raw)

I have problems with queries over tsearch index.
I have a table of books, with 1200000 registers. I have created an GIST
index over the title and subtitle,

CREATE INDEX "idxts2_titsub_idx" ON "public"."libros" USING gist
("idxts2_titsub");

My problems started when i execute my queries.
For example, i execute a simple query like this one:
explain analyze
        SELECT isbn, titulo
          FROM libros
         WHERE idxts2_titsub @@ to_tsquery('default_spanish',
to_ascii('sevilla'))
         ORDER BY titulo
         LIMIT 10;
This query take more than 10 secods, and i think this is too much for such
an easy query.
Every night, i execute a VACUUM ANALYZE over my data base.

The query plan of this query, is the next one:
QUERY PLAN
Limit  (cost=4725.18..4725.20 rows=10 width=56) (actual time=
17060.826..17061.078 rows=10 loops=1)
  ->  Sort  (cost=4725.18..4728.23 rows=1223 width=56) (actual time=
17060.806..17060.874 rows=10 loops=1)
        Sort Key: titulo
        ->  Bitmap Heap Scan on libros  (cost=45.28..4662.46 rows=1223
width=56) (actual time=10831.530..16957.667 rows=2542 loops=1)
              Filter: (idxts2_titsub @@ '''sevilla'''::tsquery)
              ->  Bitmap Index Scan on idxts2_titsub_idx
(cost=0.00..45.28rows=1223 width=0) (actual time=
10830.051..10830.051 rows=2586 loops=1)
                    Index Cond: (idxts2_titsub @@ '''sevilla'''::tsquery)
Total runtime: 17062.665 ms

I have no idea what is happening. Why the Bitmap Index Scan and the Bitmap
Heap Scan cost so much time?

I have a  2GB RAM memory Server.

Thanks every body for your healp and sorry for my English

view thread (3+ messages)  latest in thread

Message-ID: <bd8b58a40702200241y7ad2ae60q4e39bbfcfe1eed2f@mail.gmail.com>
Permalink:  ../bd8b58a40702200241y7ad2ae60q4e39bbfcfe1eed2f@mail.gmail.com/
Also on:    postgresql.org/message-id/bd8b58a40702200241y7ad2ae60q4e39bbfcfe1eed2f@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: rafacomino@gmail.com, pgsql-general@postgresql.org, pgsql-sql@postgresql.org
  Subject: Re: Having performance problems with TSearch2
  In-Reply-To: <bd8b58a40702200241y7ad2ae60q4e39bbfcfe1eed2f@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