开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜