Subject Re: [firebird-support] using indices
Author Sergio H. Gonzalez
Hi Paul and Anderson!!

> if
> A+0=A
> why do you bother anyway? =)

Because the table may have a lot of records and just a few with saldo <> 0, so I
dont want firebird to sum a lot of records that will not have any effect on the
result. If olny adds the records that matters the query will run faster. Am I
right? Please, tell me if I'm wrong...

Anyway, I have a new problem now... I added a new condition:

select sum(saldo) from fac_com where (ABS(SALDO)>0) and (id_proveedor =
:id_proveedor)

I have an index on id_proveedor also, and when I run the query I get:

Plan
PLAN (FAC_COM INDEX (FAC_COM_IDX3))

FAC_COM_IDX3 is the index on id_proveedor

Why FB does not uses both indices?

-s