Hello
I would to repeatably update non indexed column of temp table. I
expected cheap operation, but it isn't true.
p ostgres=# create temp table x(a int primary key, b int);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"x_pkey" for table "x"
CREATE TABLE
Time: 363,339 ms
postgres=# insert into x values(1,0);
INSERT 0 1
Time: 11,676 ms
postgres=# create or replace function s1() returns void as $$ begin
for i in 1..100000 loop update x set b = i where a = 1; end loop;
return; end; $$ language plpgsql;
CREATE FUNCTION
Time: 113,052 ms
postgres=# select s1();s1
----
(1 row)
Time: 255223,249 ms
postgres=# select pg_total_relation_size('x');pg_total_relation_size
------------------------ 3686400
(1 row)
the size of table was significantly increased :(.
what I doing wrong?
Regards
Pavel Stehule