Updating where id in stored procedure - enormous amount of fetches
UPDATE TABLE SET SOMETHING = 1 WHERE ID IN (SELECT ID FROM STORED_PROCEDURE)
Records in TABLE = 2100
Records from stored procedure = 50
This statement cousing enormous amount of fetches (31M!) on firebird 2.5 server. Why? Shouldn't it first select id's from stored procedure and then put it in where clau开发者_如何学运维se? What should I do to make it work?
Try something like this:
declare variable myid integer;
begin
for
select id from stored_procedure into :myID
do begin
update table set something = 1 where table.id = :myID;
end
end
精彩评论