Subject | Re: [firebird-support] Firebird vs Postgres |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2007-01-08T09:24:10Z |
Richard Wesley wrote:
of expression indexes? To me, it seems more like some statement to use
in the SELECT part (which doesn't use indexes anyway). And if you really
use it in the where clause and have indexed func(arg), I would expect
that changing
WHERE (CASE WHEN arg is NULL THEN CAST(NULL AS result_type) ELSE func(arg)
END) = <value or other expression>
into
WHERE (CASE WHEN arg is NULL THEN CAST(NULL AS result_type) ELSE func(arg)
END) = <value or other expression> AND
func(arg) = <value or other expression>
would produce the same result and use the expression index (though I
would of course expect NULL to not equal any record since NULL isn't
even equal to NULL).
HTH,
Set
> Just about every UDF that ships with FB seems to assume that NULL ==Do you use this in your WHERE clause and use the new Fb 2 functionality
> 0. Round, Sign, Sin, you name it. So for our calculations, we have
> to wrap each one in a
>
> (CASE WHEN arg is NULL THEN CAST(NULL AS result_type) ELSE func(arg)
> END)
>
> which I am sure wreaks havoc on any indexing we may have defined.
of expression indexes? To me, it seems more like some statement to use
in the SELECT part (which doesn't use indexes anyway). And if you really
use it in the where clause and have indexed func(arg), I would expect
that changing
WHERE (CASE WHEN arg is NULL THEN CAST(NULL AS result_type) ELSE func(arg)
END) = <value or other expression>
into
WHERE (CASE WHEN arg is NULL THEN CAST(NULL AS result_type) ELSE func(arg)
END) = <value or other expression> AND
func(arg) = <value or other expression>
would produce the same result and use the expression index (though I
would of course expect NULL to not equal any record since NULL isn't
even equal to NULL).
HTH,
Set