pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sergey Burladyan <eshkinkot@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Why creating GIN table index is so slow than inserting data into empty table with the same index?
Date: Tue, 24 Mar 2009 03:59:34 +0300
Message-ID: <874oxjrb0p.fsf@seb.progtech.ru> (raw)


example:

select version();
                                          version
--------------------------------------------------------------------------------------------
 PostgreSQL 8.3.6 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real (Debian 4.3.3-3) 4.3.3

show maintenance_work_mem ;
 maintenance_work_mem
----------------------
 128MB

create table a (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int);

insert into a select n, n, n, n, n, n from generate_series(1, 100000) as n;
INSERT 0 100000
Время: 570,110 мс

create index arr_gin on a using gin ( (array[i1, i2, i3, i4, i5, i6]) );
CREATE INDEX
Время: 203068,314 мс

truncate a;
drop index arr_gin ;

create index arr_gin on a using gin ( (array[i1, i2, i3, i4, i5, i6]) );
CREATE INDEX
Время: 3,246 мс

insert into a select n, n, n, n, n, n from generate_series(1, 100000) as n;
INSERT 0 100000
Время: 2405,481 мс

select pg_size_pretty(pg_total_relation_size('a')) as total,
       pg_size_pretty(pg_relation_size('a')) as table;
  total  |  table
---------+---------
 9792 kB | 5096 kB


203068.314 ms VS 2405.481 ms, is this behaviour normal ?

Thanks !

-- 
Sergey Burladyan



view thread (4+ messages)  latest in thread

Message-ID: <874oxjrb0p.fsf@seb.progtech.ru>
Permalink:  ../874oxjrb0p.fsf@seb.progtech.ru/
Also on:    postgresql.org/message-id/874oxjrb0p.fsf@seb.progtech.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: eshkinkot@gmail.com
  Subject: Re: Why creating GIN table index is so slow than inserting data into empty table with the same index?
  In-Reply-To: <874oxjrb0p.fsf@seb.progtech.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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