Are mathematical functions in MySQL faster than PHP? -
i've been working mysql while, i've never used supported mathematical functions, such floor()
, sqrt()
, crc32()
, etc.
is faster / better use these functions in queries rather doing same on result set php?
edit: don't think question duplicate of this, question mathematical functions, listed on page linked, not concat()
or now()
or other function in question. please consider before flagging.
there's no general answer that. shouldn't go out of way math in sql instead of php; doesn't make of difference, if there any. however, if you're doing sql query anyway, , have choice of doing operation in php before send mysql or in query itself... still won't make of difference. oftentimes there logical difference, in terms of when , how operation performed , needs performed , code best kept maintainability , reuse. should first consideration, not performance.
overall, have really complex math of make difference whatsoever. simple math operations trivial in virtually language , environment. if in doubt, benchmark specific case.
Comments
Post a Comment