Re: The cost of visibillity testing? (gin-search)

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Jesper Krogh <jesper(at)krogh(dot)cc>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: The cost of visibillity testing? (gin-search)
Date: 2010-12-21 19:35:03
Message-ID: 4D110167.9010006@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21.12.2010 21:25, Jesper Krogh wrote:
> The first query should have the cost of the GIN-search +
> visibillity-test of 158K tuples,
> the latter should have the cost of visibillity-testing 168K tuples. If
> we set the cost
> of actually searching GIN to 0 then the gin-search - visibillity costs:
> 95/158000 0.000373ms/tuple
> where the seq-scan case costs close to 0.001ms/tuple (close to 3 times
> as much).
>
> So I have a strong feeling that GIN is cheating on the visibillity tests
> otherwise I have problems imagining how it ever can become faster to
> execute
> than the seq_scan of the table.
>
> Or is a Bitmap Heap Scan simply 3 times faster than a Seq-scan for
> visibillity-testing?

It certainly shouldn't be.

> What have I missed in the logic?

Perhaps you have a lot of empty space or dead tuples that don't match
the query in the table, which the sequential scan has to grovel through,
but the bitmap scan skips? What does EXPLAIN ANALYZE of both queries say?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Eric Ridge 2010-12-21 19:35:09 Re: bug in SignalSomeChildren
Previous Message Robert Haas 2010-12-21 19:33:41 Re: bug in SignalSomeChildren