mysql - Query Optimization (Function Vs SubQuery) -


in mysql better use function(included subquery) in store procedure instead of direct writing subquery, make difference or code reuse?

the answer quite simple: give try , measure results; preferably on test-set realistic. (you might not see difference when there 2 records in table, effect on 2 million records gigantic)

you can test in way:

$starttime = microtime(true); // codes $endtime = microtime(true); echo $duration = $endtime - $starttime; 

imho, subquery (a lot) faster same functionality stored in function. i'm mssql-biased , can't quite tell if mysql different; doubt it.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -