are there any method that "Update" command not affect other unrelated indices?

From: sunpeng <bluevaley(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: are there any method that "Update" command not affect other unrelated indices?
Date: 2010-10-12 22:03:26
Message-ID: AANLkTi=zhUeL=2N_m=E-dR+hzAmVK6PcvxwgR7Y1rf3+@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, I have the following table:
CREATE TABLE A
(
a1 integer not null,
a2 integer,
a3 integer,
a4 integer
)
and have the following four indices:
create index ind_a1 on A USING gist(a1);
create index ind_a2 on A USING gist(a2);
create index ind_a3 on A USING gist(a3);
create index ind_a4 on A USING gist(a4);

now we have 10,000 update command executions using spi_exeplan():
SPI_prepare(); // prepare the plan for "update A set a4 = $1;"
for(i=0;i<10000;i++ ){
SPI_execute_plan();// update A set a4 = i;
}

the question is why all four indices updated in the execution of
SPI_execute_plan()?
I think there should only one index, that is ind_a4 be updated, how to avoid
other three indices updated?
thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ben Carbery 2010-10-12 22:38:15 Re: are there any method that "Update" command not affect other unrelated indices?
Previous Message Bruce Momjian 2010-10-12 22:01:10 Re: Text search parser's treatment of URLs and emails