Re: The cost of visibillity testing? (gin-search) - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: The cost of visibillity testing? (gin-search)
Date
Msg-id 4D110167.9010006@enterprisedb.com
Whole thread Raw
In response to The cost of visibillity testing? (gin-search)  (Jesper Krogh <jesper@krogh.cc>)
Responses Re: The cost of visibillity testing? (gin-search)  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-hackers by date:

Previous
From: Eric Ridge
Date:
Subject: Re: bug in SignalSomeChildren
Next
From: Alvaro Herrera
Date:
Subject: Re: bug in SignalSomeChildren