Re: Index scan is not working

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Kiran <bangalore(dot)kiran(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index scan is not working
Date: 2016-09-19 16:55:15
Message-ID: CAMkU=1z0mpvGgZrtcmnnE3Act_0Vou6d8y2CobrNCR+1K1YGXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 19, 2016 at 5:10 AM, Kiran <bangalore(dot)kiran(at)gmail(dot)com> wrote:

> Dear All,
>
> I have a table called question which has a ts_vector column *weighted_tsv*
> .
> I have gin indexed the weighted_tsv column.
>
> When I query using the following
>
> EXPLAIN ANALYZE select * from question where weighted_tsv @@
> to_tsquery('Hur&ofta');
>
> I get the following output
>
> "Bitmap Heap Scan on question (cost=12.33..25.38 rows=10 width=731)
> (actual time=0.058..0.062 rows=3 loops=1)"
> " Recheck Cond: (weighted_tsv @@ to_tsquery('Hur&ofta'::text))"
> " Heap Blocks: exact=3"
> " -> Bitmap Index Scan on weighted_tsv_question_idx (cost=0.00..12.33
> rows=10 width=0) (actual time=0.052..0.052 rows=3 loops=1)"
> " Index Cond: (weighted_tsv @@ to_tsquery('Hur&ofta'::text))"
> "Planning time: 0.205 ms"
> "Execution time: 0.104 ms"
>
>
> Why the query is using the Bitmap ? Not the Index scan ?
>

Gin indexes do not support non-bitmap index scans, only bitmap index scans.

> Also to_tsquery is casting to ::text. Is this normal ?
>

Yes.

It is pointless to test performance against a table with 10 rows. If your
table will soon have a few thousand rows, then either wait until it does,
or create a test server and fabricate a few thousand rows worth of test
data.

Cheers,

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Jungwirth 2016-09-19 18:05:45 Re: journaling / time travel
Previous Message Jeff Janes 2016-09-19 16:41:33 Re: performance problems with bulk inserts/updates on tsrange with gist-based exclude constrains