12.07.2012 22:08, Leyne, Sean wrote: > > This seems to be wrong. I don't say it's correct, I just explain why it works this way.
> First, in the original example: > select u, u, u > from (select gen_uuid() u from rdb$database) > > there is only one instance of the expression -- there are 3 references to the > *resolved* expression. In Firebird, there is no such thing as "instance of the expression" or "resolved expression". All expression references are just copies of the original expression. > P.S. This subject would extend to how the engine currently considers all > functions as "variant" (the answer changes with each call), where most > functions/UDFs are "invariant". This causes optimization problems in cases > where the SQL reads: > > SELECT ... FROM ... WHERE ColumnA = COS( :Param) > > In this case, the result of the COS() function is a fixed value and thus the > optimizer should use any ColumnA index, but it doesn't. I don't get the point, sorry. Are you talking about caching invariant expression results or about index based optimizations? Predicate like "ColumnA = COS(:Param)" will always use an index for ColumnA regardless of whether COS is variant or invariant. Dmitry ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel