Subject speed up query
Author redtneen
hi firebird group

i tried this code

for
select "Material", "Debit", "Credit"
from "Items"
into :"aMat", :"aDebit", :"aCredit"
do
begin
--calulations
end

========= Execute ==========
PLAN (BillItems NATURAL)
----------------------------
Prepare time: 0:0:0
Execute time: 0:0:0
Fetch time: 0 :4[s] :485 [ms]
Rows affected: 753855

then i tried

for
select "Material", "Debit", "Credit"
from "Items"
where ("Kind" not in (6, 44, 45, 46, 47, 48, 49, ...))
into :"aMat", :"aDebit", :"aCredit"
do
begin
--calulations
end

========= Execute ==========
PLAN (BillItems NATURAL)
----------------------------
Prepare time: 0:0:0
Execute time: 0:0:0
Fetch time: 0 :5 [s] :719 [ms]
Rows affected: 239420

can anyone explain why time goes up although records are less
and how to speed up this query

notes: field "Kind" it's foreign key to table "Kinds"

thanks