mysql - Which has better performance, Java or DB functions? -
i'm writing web app , don't know technique faster: implement code using java native or database functions (mysql or maridb in case).
i.e: using java:
string new_string = my_string.replace('-',''); query query = "select * my_table id=" + new_string;
i.e: using database functions:
query query = "select * my_table id=replace(" + new_string + ",'-','');
thanks!
ps: please, forget bad code, know it. it's explain idea :-)
the performance difference going negligible or there more no difference @ all. replacement in java sql logs cleaner if ever want @ them debug / see what's been happening. it's easier search/read through replaced strings think.
Comments
Post a Comment