Hi,

Shouldn't sub-query results be independent of outer-queries? I understand
> the optimization and why it is useful - in some cases. However, when
> SET(@variable, value) is in the selectExpression, the order and number of
> rows SET(...) is applied to, are critical for correct results.
>

It depends on what you consider a 'correct' result. I agree it might be
confusing if not all rows are read, but disabling optimizations depending
on whether such features are used also seems to be wrong.

What if the planner looked for the use of SET(...) in sub-queries before
> moving a WHERE clause down, and skip the optimization if a SET is used?
>

It sounds like it would still not match what MySQL is doing...

I don't really know the best solution. All possible solutions seem to be
very tricky to get right, and I'm not sure if it's really worth the effort
and the added complexity in the code. For now, I will document that when
used in a subquery, not all rows might be read depending on the query plan.

Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to