Subject | FB-2.5.1, Trigger isn using a index for the update-statment or |
---|---|
Author | simonsays768 |
Post date | 2012-09-27T19:09:56Z |
Hallo,
i have two update statements(example):
update a (4000 records / one record to update)
set aid = 2
where id = 1
update b (40000 records / one record to update)
set bid = 2
where id = 1
if i let them run, they will both update the data in ~30ms.
now, i want to create a trigger with the second statement on the table "a", something like this:
CREATE OR ALTER trigger asdf1 for a
active after update position 230
as
begin
update b
set bid = new.aid
where id = new.id
end
i execute the statement to update table "a" and it will update both tables, but it runs ~500ms.
on both tables are indices for the "id"-column.
if i delete the index for table "b" the statement uses also ~500ms to run.
therefor i thought, i use for the update a plan in the trigger like this:
update b
set bid = 2
where id = 1
plan (b index (b_id_idx1));
i can run this statement, but the trigger isnt allowing the statement to be saved.
"index cannot be used in the specified plan.
index b_id_idx1 cannot be used in the specified plan."
(i've tested 2.5.1 and 2.5.2 RC1)
maybe someone can help me, thank you
i have two update statements(example):
update a (4000 records / one record to update)
set aid = 2
where id = 1
update b (40000 records / one record to update)
set bid = 2
where id = 1
if i let them run, they will both update the data in ~30ms.
now, i want to create a trigger with the second statement on the table "a", something like this:
CREATE OR ALTER trigger asdf1 for a
active after update position 230
as
begin
update b
set bid = new.aid
where id = new.id
end
i execute the statement to update table "a" and it will update both tables, but it runs ~500ms.
on both tables are indices for the "id"-column.
if i delete the index for table "b" the statement uses also ~500ms to run.
therefor i thought, i use for the update a plan in the trigger like this:
update b
set bid = 2
where id = 1
plan (b index (b_id_idx1));
i can run this statement, but the trigger isnt allowing the statement to be saved.
"index cannot be used in the specified plan.
index b_id_idx1 cannot be used in the specified plan."
(i've tested 2.5.1 and 2.5.2 RC1)
maybe someone can help me, thank you