sql execution plan - SQL chain AND operator, all executed? -
i wondering if in sql request using several , statement, every , executed or triggered when previous , ok?
in example :
select * my_table when > 5 , b < 10
if condition > 5 not respected, test b < 10 triggered? or in java triggered when > 5 valid?
thanks ;)
bye !
in general, sql engines implement "short-circuiting", meaning execution of conditions stops when final value known.
however, pretty unimportant. first, cannot depend on order of evaluation of conditions. so, don't know evaluated first. second, engine may use alternative execution paths (such using indexes).
and, finally, short-circuiting typically has minimal impact on performance. reading data typically more important. 1 exception when 1 of conditions uses complex functions. in case, use case
or subqueries ensure order of execution.
Comments
Post a Comment