MySQL: Is there a performance hit comparing numbers with an important precision -
i'm wondering in mysql if better performance compare numbers important precision or round them before comparing, knowing comparison precision less important compared numbers precision.
ex:
select 0.123456789101112123456789101112 < 0.987654321012345987654321012345
or
select round(0.123456789101112123456789101112,2) < round(0.987654321012345987654321012345,2)
there's performance hit in version uses round()
.
first, calling function more expensive not calling function.
second, , possibly more significantly, if there's index on column, can't used if perform function on column before comparing something.
but getting right answer practically more important using efficient method.
Comments
Post a Comment