Subject Re: delete with null not executed
Author hybriszero
--- In Firebird-Java@yahoogroups.com, "hybriszero" <hybriszero@...>
> so instead of doing
> delete ... where x=?
> i now do
> delete ... where x=? or (?=0 and x is null)

this works but unfortunately it changes the execution plan for a query
with a where clause of 1 column (the primary key)

i.e.
version 1:
select bla bla from table where id=100

version 2:
select bla bla from table where id=100 or (1=0 and id is null)

from:

PLAN (A INDEX (PK_LogRichieste))

to

PLAN (A INDEX (PK_LogRichieste, PK_LogRichieste))

this is a query i do to check if in the destination db the record is
already present so i choose between insert or update.

i don't know what the second plan exactly means but it destroys the
performance.

In my test, doing an rs.next() takes less that 1 ms with the first one
and about 200 with the second one.

I have to process thousands and thousand of records...
:(