String performacne: PHP vs MySQL -


this question has answer here:

are there performance concerns of note when using mysql's concat() function in select query? faster/slower/negligible simple select, , format strings view using php after result set database returned? or more complicated sql query multiple calls concat() returns string formatted view better approach?

ie this:

select concat(lastname, ', ', firstname) people; 

faster/slower/no difference this:

<?php     $query = 'select lastname, firstname people';     ...      $name = $data['lastname'] . ', ' . $data['firstname']; //or     $name = sprintf("%s, %s", $data['lastname'], $data['firstname']); ?> 

you're better off in cases doing filtering , data massaging sql engine versus on web server.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -