Why creating GIN table index is so slow than inserting data into empty table with the same index?

Список
Период
Сортировка
От Sergey Burladyan
Тема Why creating GIN table index is so slow than inserting data into empty table with the same index?
Дата
Msg-id 874oxjrb0p.fsf@seb.progtech.ru
обсуждение исходный текст
Ответы Re: Why creating GIN table index is so slow than inserting data into empty table with the same index?  (Tom Lane)
Список pgsql-performance
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

В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Why creating GIN table index is so slow than inserting data into empty table with the same index?
Следующее
От: Kouber Saparev
Дата:
Сообщение: Re: LIMIT confuses the planner