Re: Bitmap and-ing between btree and gin?

From: Jordi <jmaillists(at)promani(dot)be>
To: pgsql-performance(at)postgresql(dot)org
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us
Subject: Re: Bitmap and-ing between btree and gin?
Date: 2016-02-04 17:19:31
Message-ID: 56B38823.40809@promani.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi Tom, thanks for your reply, much appreciated.

So basically you're saying it's hard to do sorting in any way when a gin
index is involved? Neither with a complete multi-column btree_gin index
because it doesn't support sorting per definition, nor with a seperate
gin and btree because there would be an extra post-sorting step involved
over the FULL resultset (because of the LIMIT).

Then would you have any hint on how to implement pagination when doing
full text search?
Cause in theory, if I gave it a id>100 LIMIT 100, it might just as well
return me results 150 to 250, instead of 100 to 200...

PS: I already tried maxing the statistics target setting and running
ANALYSE after, with no change.

Regards,
Jordi

On 04-02-16 17:08, Tom Lane wrote:
> Jordi <jmaillists(at)promani(dot)be> writes:
>> I've been trying to get a query use indexes and it has raised a doubt
>> whether pgsql supports bitmap and-ing between a multi-column btree index
>> and a gin index.
> Sure. But such a plan would give an unordered result, meaning that we'd
> have to process the whole table before doing the ORDER BY/LIMIT. The
> planner evidently thinks that it's better to try to process the rows in
> ID order so it can stop as soon as it's got 100. If it's wrong about
> that, that's likely because it's got a bad estimate of the selectivity of
> the other WHERE conditions. You might see if you can improve the
> statistics for the search_vector column.
>
> regards, tom lane
>
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Filip Rembiałkowski 2016-02-04 21:12:39 bad COPY performance with NOTIFY in a trigger
Previous Message Tom Lane 2016-02-04 16:08:41 Re: Bitmap and-ing between btree and gin?