Subject Re: Re[3]: [ib-support] Strange query problem
Author Martijn Tonies

> But, here it is another one:
> "select
> pty.party_id, bill.due_date, bill.service_tax
> from
> tbl_party pty join tbl_bill bill on (bill.account_id = pty.account_id)
and bill.service_id = 1
> where
> not exists (select * from tbl_invalid inv where inv.party_id =
> All of the fields you see here except "bill.due_date" and
> "bill.service_tax" are indexed fields.

Do you see DUE_DATE or SERVICE_TAX in the WHERE clase?
If not - WHY should an index on these fields be used?

> This query without the WHERE clause executes fast (1400 ms). When
> I put the WHERE clause it goes to something like 15 minutes :((

Well, the WHERE clause isn't exactly an easy one and will be executed
for each row in the PTY table... Happy selecting!

With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions

"This is an object-oriented system.
If we change anything, the users object."