pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Add gin_clean_pending_list function to clean up GIN pending list
4+ messages / 3 participants
[nested] [flat]

* pgsql: Add gin_clean_pending_list function to clean up GIN pending list
@ 2016-01-28 03:58 Fujii Masao <fujii@postgresql.org>
  2016-02-06 04:09 ` Re: pgsql: Add gin_clean_pending_list function to clean up GIN pending list Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Fujii Masao @ 2016-01-28 03:58 UTC (permalink / raw)
  To: pgsql-committers

Add gin_clean_pending_list function to clean up GIN pending list

This function cleans up the pending list of the GIN index by
moving entries in it to the main GIN data structure in bulk.
It returns the number of pages cleaned up from the pending list.

This function is useful, for example, when the pending list
needs to be cleaned up *quickly* to improve the performance of
the search using GIN index. VACUUM can do the same thing, too,
but it may take days to run on a large table.

Jeff Janes,
reviewed by Julien Rouhaud, Jaime Casanova, Alvaro Herrera and me.

Discussion: CAMkU=1x8zFkpfnozXyt40zmR3Ub_kHu58LtRmwHUKRgQss7=iQ@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7f46eaf035440564e7dae3b03916735b92c83248

Modified Files
--------------
doc/src/sgml/func.sgml             |   26 ++++++++++++++++++
doc/src/sgml/gin.sgml              |    4 ++-
doc/src/sgml/ref/create_index.sgml |    4 +--
src/backend/access/gin/ginfast.c   |   52 ++++++++++++++++++++++++++++++++++++
src/include/access/gin_private.h   |    3 +++
src/include/catalog/catversion.h   |    2 +-
src/include/catalog/pg_proc.h      |    2 ++
src/test/regress/expected/gin.out  |   13 +++++++++
src/test/regress/sql/gin.sql       |    6 +++++
9 files changed, 108 insertions(+), 4 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Add gin_clean_pending_list function to clean up GIN pending list
  2016-01-28 03:58 pgsql: Add gin_clean_pending_list function to clean up GIN pending list Fujii Masao <fujii@postgresql.org>
@ 2016-02-06 04:09 ` Tom Lane <tgl@sss.pgh.pa.us>
  2016-02-07 17:19   ` Re: pgsql: Add gin_clean_pending_list function to clean up GIN pending list Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2016-02-06 04:09 UTC (permalink / raw)
  To: Fujii Masao <fujii@postgresql.org>; +Cc: pgsql-committers

Fujii Masao <fujii@postgresql.org> writes:
> Add gin_clean_pending_list function to clean up GIN pending list

The regression test case added by this commit is unstable, as per
http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=spoonbill&dt=2016-02-06%2000%3A00%3A06

I imagine what happened there is that autovacuum came along and cleared
the pending-list before the test query could.

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Add gin_clean_pending_list function to clean up GIN pending list
  2016-01-28 03:58 pgsql: Add gin_clean_pending_list function to clean up GIN pending list Fujii Masao <fujii@postgresql.org>
  2016-02-06 04:09 ` Re: pgsql: Add gin_clean_pending_list function to clean up GIN pending list Tom Lane <tgl@sss.pgh.pa.us>
@ 2016-02-07 17:19   ` Fujii Masao <masao.fujii@gmail.com>
  2016-02-08 14:42     ` Re: pgsql: Add gin_clean_pending_list function to clean up GIN pending list Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Fujii Masao @ 2016-02-07 17:19 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Fujii Masao <fujii@postgresql.org>; pgsql-committers

On Sat, Feb 6, 2016 at 1:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Fujii Masao <fujii@postgresql.org> writes:
>> Add gin_clean_pending_list function to clean up GIN pending list
>
> The regression test case added by this commit is unstable, as per
> http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=spoonbill&dt=2016-02-06%2000%3A00%3A06
>
> I imagine what happened there is that autovacuum came along and cleared
> the pending-list before the test query could.

Thanks for the report! Yes, that's possible. I'm thinking to disable
autovacuum for the index which pg_clean_pending_list() is working on
by setting autovacuum_enabled reloption when creating the table.
Patch attached. This patch also sets gin_pending_list_limit reloption
to 4MB, just to be safe, so that "make installcheck" will not fail
even when gin_pending_list_limit GUC is very small.

Barring objection, I'll push this patch.

Regards,

-- 
Fujii Masao

-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Attachments:

improve_gin_regression_test.patch (application/octet-stream, 1.6K) download diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out index cc7601c..a3911a6 100644 --- a/src/test/regress/expected/gin.out +++ b/src/test/regress/expected/gin.out @@ -4,8 +4,9 @@ -- There are other tests to test different GIN opclassed. This is for testing -- GIN itself. -- Create and populate a test table with a GIN index. -create table gin_test_tbl(i int4[]); -create index gin_test_idx on gin_test_tbl using gin (i) with (fastupdate = on); +create table gin_test_tbl(i int4[]) with (autovacuum_enabled = off); +create index gin_test_idx on gin_test_tbl using gin (i) + with (fastupdate = on, gin_pending_list_limit = 4096); insert into gin_test_tbl select array[1, 2, g] from generate_series(1, 20000) g; insert into gin_test_tbl select array[1, 3, g] from generate_series(1, 1000) g; select gin_clean_pending_list('gin_test_idx')>10 as many; -- flush the fastupdate buffers diff --git a/src/test/regress/sql/gin.sql b/src/test/regress/sql/gin.sql index 31890b4..c566e9b 100644 --- a/src/test/regress/sql/gin.sql +++ b/src/test/regress/sql/gin.sql @@ -5,8 +5,9 @@ -- GIN itself. -- Create and populate a test table with a GIN index. -create table gin_test_tbl(i int4[]); -create index gin_test_idx on gin_test_tbl using gin (i) with (fastupdate = on); +create table gin_test_tbl(i int4[]) with (autovacuum_enabled = off); +create index gin_test_idx on gin_test_tbl using gin (i) + with (fastupdate = on, gin_pending_list_limit = 4096); insert into gin_test_tbl select array[1, 2, g] from generate_series(1, 20000) g; insert into gin_test_tbl select array[1, 3, g] from generate_series(1, 1000) g;
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: pgsql: Add gin_clean_pending_list function to clean up GIN pending list
  2016-01-28 03:58 pgsql: Add gin_clean_pending_list function to clean up GIN pending list Fujii Masao <fujii@postgresql.org>
  2016-02-06 04:09 ` Re: pgsql: Add gin_clean_pending_list function to clean up GIN pending list Tom Lane <tgl@sss.pgh.pa.us>
  2016-02-07 17:19   ` Re: pgsql: Add gin_clean_pending_list function to clean up GIN pending list Fujii Masao <masao.fujii@gmail.com>
@ 2016-02-08 14:42     ` Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2016-02-08 14:42 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Fujii Masao <fujii@postgresql.org>; pgsql-committers

On Mon, Feb 8, 2016 at 2:19 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
> On Sat, Feb 6, 2016 at 1:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Fujii Masao <fujii@postgresql.org> writes:
>>> Add gin_clean_pending_list function to clean up GIN pending list
>>
>> The regression test case added by this commit is unstable, as per
>> http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=spoonbill&dt=2016-02-06%2000%3A00%3A06
>>
>> I imagine what happened there is that autovacuum came along and cleared
>> the pending-list before the test query could.
>
> Thanks for the report! Yes, that's possible. I'm thinking to disable
> autovacuum for the index which pg_clean_pending_list() is working on
> by setting autovacuum_enabled reloption when creating the table.
> Patch attached. This patch also sets gin_pending_list_limit reloption
> to 4MB, just to be safe, so that "make installcheck" will not fail
> even when gin_pending_list_limit GUC is very small.
>
> Barring objection, I'll push this patch.

Okay, pushed.

Regards,

-- 
Fujii Masao


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2016-02-08 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-28 03:58 pgsql: Add gin_clean_pending_list function to clean up GIN pending list Fujii Masao <fujii@postgresql.org>
2016-02-06 04:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-02-07 17:19   ` Fujii Masao <masao.fujii@gmail.com>
2016-02-08 14:42     ` Fujii Masao <masao.fujii@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox