Re: GIN improvements part 3: ordering in index

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GIN improvements part 3: ordering in index
Date: 2013-06-17 12:56:28
Message-ID: CAPpHfdsvHhWuKXkSDKWqu+8dqczr=TdHzo0ssghTEcQg9sa4VA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jun 15, 2013 at 3:02 AM, Alexander Korotkov <aekorotkov(at)gmail(dot)com>wrote:

> attached patch implementing ordering inside GIN index. This is third patch
> of GIN improvements, see previous two:
>
> http://www.postgresql.org/message-id/CAPpHfduxv-iL7aedwPW0W5fXrWGAKfxijWM63_hZujaCRxnmFQ@mail.gmail.com
>
> http://www.postgresql.org/message-id/CAPpHfdvftaJq7www381naLw1=4u0h+qpXgWvNhcEB9HMVywbGg@mail.gmail.com
>
> This patch introduces new interface method of GIN which takes same
> arguments as consistent but returns float8.
> float8 gin_ordering(bool check[], StrategyNumber n, Datum query, int32
> nkeys, Pointer extra_data[], bool *recheck, Datum queryKeys[], bool
> nullFlags[], Datum addInfo[], bool addInfoIsNull[])
> This patch implements gingettuple method which can return ordering data
> using KNN infrastructure. Also it introduces >< operator for fts which
> support ordering in GIN index. Some example:
>
> postgres=# explain analyze select * from dblp_titles2 where tsvector @@
> to_tsquery('english', 'statistics') order by tsvector ><
> to_tsquery('english', 'statistics') limit 10;
> QUERY
> PLAN
>
> -------------------------------------------------------------------------------------------------------------------------------------------------
> Limit (cost=12.00..48.22 rows=10 width=136) (actual time=6.999..7.120
> rows=10 loops=1)
> -> Index Scan using dblp_titles2_idx on dblp_titles2
> (cost=12.00..43003.03 rows=11868 width=136) (actual time=6.996..7.115
> rows=10 loops=1)
> Index Cond: (tsvector @@ '''statist'''::tsquery)
> Order By: (tsvector >< '''statist'''::tsquery)
> Total runtime: 7.556 ms
> (5 rows)
>

Attached version of patch has some refactoring and bug fixes.

------
With best regards,
Alexander Korotkov.

Attachment Content-Type Size
gin_ordering.2.patch.gz application/x-gzip 12.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2013-06-17 12:57:30 Re: refresh materialized view concurrently
Previous Message Alexander Korotkov 2013-06-17 12:55:22 Re: GIN improvements part2: fast scan