Subject Re: [firebird-support] Re: Count(id) returns null. although count should never return null...
Author Jason Dodson
Actually, these "little tricks" are what make some RDBMS's worth using.

I understand the concern of the upfront calculations on a query (IE: Can this query be addressed by a special "trick"? If so, which one?). Maybe have
a configuration parameter like UseStupidTricks=True/False. Personally, I would have this on by default (Your opinion may vary), so that experienced
programmers can toggle this off when they are confident that they get no benefit from it.

Jason

Ann W. Harrison wrote:
> Adam wrote:
>
>>Just an aside, and a possible gotcha, the condition you use is not
>>very efficient in Firebird
>>
>>WHERE 1=0
>>
>>will be evaluated for every record in the table (in Firebird 1.5.2,
>>not sure about later versions).
>>
>>Hopefully some time in the future Firebird will be optimised to
>>improve this, but till then, this works a treat.
>>
>
>
> That's actually an interesting question. Academic optimizers are full
> of little tricks to catch idiotic queries and make them fast, with no
> benefit to queries that a reasonable programmer would ever write.
> Should we go that way? How much code - and execution time - should we
> devote that effort?
>
>
> Regards,
>
>
> Ann