Subject | Re: [firebird-support] using indices |
---|---|
Author | Sergio H. Gonzalez |
Post date | 2008-09-19T04:45:06Z |
Hi Paul and Anderson!!
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
> ifBecause the table may have a lot of records and just a few with saldo <> 0, so I
> A+0=A
> why do you bother anyway? =)
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